How set the Backgound Text using javascript or JQuery in the input text field or text box?
<p>I hardly know any Jquery or Javascript. So, I beg your pardon in advance if I ask any question very stupidly. </p>

<p>I want to set backgound text for two text fields. 
My two text fields are </p>

<pre><code>&lt;asp:TextBox ID="txtFName" backgroundText="First Name" runat="server" Width="80px"  Style="float: left;"&gt;&lt;/asp:TextBox&gt;
&lt;asp:TextBox runat="server" ID="txtLName"  backgrountText="Last Name"
                                    Width="110px" Style="float: left"&gt;&lt;/asp:TextBox&gt;
</code></pre>

<p>One of friend wrote the jquery for the first text box and it is working perfectly. 
this code is </p>

<pre><code>$(document).ready(function(){

        var inpName = $('#txtFName');
        var backgroundText = inpName.attr('backgroundText');

        inpName.val(backgroundText);

        inpName.focus(function(){
            if(inpName.val() == backgroundText) inpName.val('');
        }).blur(function(){
            if(inpName.val() == '') inpName.val(backgroundText);
        });


    }); 
</code></pre>

<p>But if I use this code for the last-name text box, then it does not work
what I did, I copied the entire Jquery code and just replace the <code>var inpName = $('#txtFName');</code> as <code>var inpName = $('#txtLName');</code>
But, If I do so, My first working text box (txtFirst) does work properly.
but, If I write like this way:
$(document).ready(function(){
            checkRequiredInputs();</p>

<pre><code>        var inpName = $('#txtFName');
        var backgroundText = inpName.attr('backgroundText');

        inpName.val(backgroundText);

        inpName.focus(function(){
            if(inpName.val() == backgroundText) inpName.val('');
        }).blur(function(){
            if(inpName.val() == '') inpName.val(backgroundText);
        });

        var inpName = $('#txtLName');
        var backgroundText = inpName.attr('backgroundText');

        inpName.val(backgroundText);

        inpName.focus(function(){
            if(inpName.val() == backgroundText) inpName.val('');
        }).blur(function(){
            if(inpName.val() == '') inpName.val(backgroundText);
        });
</code></pre>

<p>I does not work anymore, Why?
Can Anyone Explain me Why is this happening? and how can I solve this problem?</p>
