MIKESTOWE.COM

you are here

Super Easy Form Highlighting

Thanks to jQuery, highlighting form fields onFocus has never been easier… just setup your hover class (in this case jHover), and add 4 lines of javascript to the top of your page, and presto… super sweet form field highlighting in less than 5 minutes!

The CSS:

1
2
3
4
5
6
<style type="text/css">
.jHover {
background: #ffc;
border: 1px solid #333;
}
</style>

The JavaScript:

1
2
3
4
5
6
<script language="javascript">
$(document).ready(function() {
$(':input').focus(function() { $(this).addClass('jHover'); });
$(':input').blur(function() { $(this).removeClass('jHover'); });
});
</script>

Share this Page:
Facebook Twitter Linkedin Reddit Tumblr Email

Leave a Reply

Your email address will not be published. Required fields are marked *