/ Published in: JavaScript

Reset input type text onfocus if value differs from default.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> $(document).ready(function(){ $("input[type=text]").focus(function(){ if(this.value == this.defaultValue){ $(this).val(""); } }); }); </script>
Comments
