24 February 2011

This tutorial shows how to create background text to your search box that will dissapear on click/focus.

Add jQuery library to your header.
Source code viewer
  1. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
Programming Language: HTML



Then add placeholder attribute to your search field.


Then add library that will create fall-back for browsers that doesn't support HTML 5. jquery.placeholder.min.js