With a little side of applesauce...

Monday, February 7, 2011

My First HTML 5 code

Nice! Instead of a javascript-y way of showing hints in a text box, use the 'placeholder' attribute:
<input name="phone_evening" type="text" placeholder="123-123-1234" id="phone_evening" tabindex="13" size="15" />


UPDATE:

Use the cool ezpz-hint jQuery plug-in for browsers which don't support HTML 5 yet.

<script type="text/javascript"
src="https://my.server.edu/forms/js/jquery.ezpz_hint.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("input#phone_day").ezpz_hint();
$("input#phone_evening").ezpz_hint();
});
</script>


Then add this style to make the hint light-gray:
.ezpz-hint { color: #AAAAAA; } 


All of this, thanks to Joey Nelson!

No comments: