Why my jquery is not working for a span tag

Posted by Shantanu Gupta on Stack Overflow See other posts from Stack Overflow or by Shantanu Gupta
Published on 2010-04-09T14:51:39Z Indexed on 2010/04/09 15:03 UTC
Read the original article Hit count: 176

Filed under:
|

I am trying to display some message in span. but it is not working.

<script type="text/javascript">
    $(document).ready(function(){
            /****************************First Name validation******************************/
        $("#txtFirstName").bind("focusout",function(){
                if($(this).val()=="" || $(this).val()=="First Name")
                    {
                    $(this).siblings("span[id*='error']").text("First Name Required");
                    $(this).val("First Name");
                    }   
            });

        $("#txtFirstName").bind("focusin",function(){
                if($(this).val()=="First Name")
                    {
                    $(this).siblings("span[id*='error']").show("slow").text("");
                    $(this).val("");                    
                    }   
            }); /********************End First Name validation*****************************/
    });

Here is my html code for above code

 <td><input id="txtFirstName" type="text" value="First Name" runat="server"/><span class="error"></span></td>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui