Allowed only Alphanumeric character


<script src=”js/jquery.js” type=”text/javascript”></script>
<script src=”js/jquery.validate.min.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“#mobilejj”).bind(‘keyup’, function(){
var TCode = document.test_form.mobilejj.value;
for(var i=0; i<TCode.length; i++)
{
var char1 = TCode.charAt(i);
var cc = char1.charCodeAt(0);
if((cc>47 && cc<58) || (cc>64 && cc<91) || (cc>96 && cc<123))
{
}
else
{
alert(‘Special character are not allowed\n\nPlease enter only alphanumeric’);
$(“#mobilejj”).val(”);
return false;
}
}
});
});
</script>

<form name=”test_form” id=”test_form” action=”” enctype=”multipart/form-data”>
<input type=”text” name=”mobilejj” id=”mobilejj” value=”” >
<input type=”text” name=”phonejj” id=”phonejj” value=””>
<input type=”submit” name=”test_send” id=”test_send” value=”Submit”>
</form>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s