Monthly Archives: February 2012

Remove value from input with jQuery

This jQuery code removes the value of a input text type when the user clicks on the input. $(document).ready(function(){ $('input:text').each(function() { var label = $(this).val(); $(this).focus(function() { if($(this).val() == label) { $(this).val(''); } }); $(this).blur(function() { if($(this).val() == '') { $(this).val(label); } }); }); });

Posted in JavaScript | 1 Comment