Saturday, 02 February 2013 13:54

how to show textbox hint when textbox empty by jquery

Written by 
Rate this item
(0 votes)

It's a very common requirement to show hint in textbox when empty
and when textbox gets focus hint goes a days many websites
implemented showing hint.there are many ways to do that by jquery.

by the following example i am going to show how one can show
hint in textbox in easier may find better example for
that in internet but this one is good enough...

function MitsolReplyBoxFocus(caller) {
var id =;
if ((jQuery(".NameTextBox").val() == "name")) { jQuery(".NameTextBox").val(""); }
function MitsolReplyBoxBlur(caller) {
var id =;
if ((jQuery(".NameTextBox").val() == "")) { jQuery(".NameTextBox").val("name"); }

function pageLoad() {

in page -

<input type='text' id='NameTextBox1' class="NameTextBox" onfocus='MitsolReplyBoxFocus(this)'
onblur='MitsolReplyBoxBlur(this)' value="name" runat="server"/>

for my application in pageLoad function i did not put any condition because
every page load i am begining may put condition if

Read 3350 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.