Why my jquery is not working for a span tag
- by Shantanu Gupta
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>