Something like this might workd (untested):

// when the text field changes
$('#myTextField').change(function(){
        // if it's empty
        if ($(this).val() == '') {
                // give it focus
                $(this).focus();
        }
};

 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Raghu
Sent: Friday, April 04, 2008 11:56 AM
To: jQuery (English)
Subject: [jQuery] JQuery bigginer


Hi I am learning JQuery and Javascript so asking this simple question.

I have a text field which has default value as Day. I want when user focus
on this text field then it become empty. How can I do this using JQuery?

 <s:textfield name="day" cssClass="textbox1" size="3" id="dayOfBirth"
value="Day" required="true" maxlength="3"/>


Reply via email to