Clear prefilled text box and change text colour
Clicking in text field clears prefilled text and changes text colour, jQuery in use.
Sample
CSS - JavaScript/jQuery - XHTML
<style type="text/css">
.myFieldOne,
.myFieldTwo,
.myFieldThree{
color:#999;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('.myFieldOne,.myFieldTwo,.myFieldThree').click(function(){
$(this).val('');
$(this).css('color','#333');
});
});
</script>
<input class="myFieldOne" type="text" value="My text field one" />
<input class="myFieldTwo" type="text" value="My text field two" />
<input class="myFieldThree" type="text" value="My text field three" />
2010
Web Development - XHTML CSS JavaScript jQuery.