Please refer the fiddle http://jsfiddle.net/a765q/1/.
If I click the reset button, the text color turns to grey. How to do?
Please refer the fiddle http://jsfiddle.net/a765q/1/.
If I click the reset button, the text color turns to grey. How to do?
I would suggest using the newer placeholder
attribute for this rather than the aproach you're going for.
modified from your fiddle!:
<input name="address" id="address" type="text" placeholder="Address" />
here is working fiddle: http://jsfiddle.net/surendraVsingh/a765q/13/
HTML
<form action="">
<input name="address" id="address" type="text" value="Address" />
<input name="reset" type="reset" value="Reset Form">
</form>
Jquery
$('#address').focus(function(){
$(this).val('');
$(this).css('color', '#000');
});
$('input[type="reset"]').click(function(){
$('#address').css('color', '#999');
});