jQuery Form Focus Plugin

This jQuery plugin will add a background color to text, password, and textarea input fields in forms when focused, and then revert to the original background color on blur. It is a one line call, with one (optional) parameter, the background color.

You can target all forms on the page with this simple line:


This will default the focused background color to: #f0f0c0

You can specify the background color as follows:


which would make the focused background color a very bright red. You can also target forms specifically, whether you only want to use it on a single form, or if you want to specify different background colors for each.



Download jQuery Form Focus Plugin


  1. @Gareth Price, sadly the CSS :focus pseudo-class isn’t supported in IE6 or IE7. If you want a wider range of browser support, this plugin will do the trick. The CSS pseudo-class is a great way to progressively enhance the site.

Comments are closed.