I am trying to use same validation funtion for all my controls. But I dont know much in jquery and not been able to pass event handler to the trigger. I want to pass textbox id to my custom function. How can i do this
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txtFirstName").bind('focusout', function()
{
$(this).trigger("customblurfocus",[$(this).val(), $(this).val() + " Required !", "Ok !"]);
}
);
$(this).bind('customblurfocus',function(defaultInputValue,ErrorMessage,ValidMessage)
{alert($(this).val());
if($(this).val()=="" || $(this).val()==defaultInputValue)
{
$(this).val(defaultInputValue);
$(this).siblings("span[id*='error']").toggleClass("error_set").text(ErrorMessage).fadeOut(3000);
}
else
{
$(this).siblings("span[id*='error']").toggleClass("error_ok").text(ValidMessage).show(1000);
}
}
);
});
</script>