JSFiddle - React, Tailwind, and code Playground
by 533135
HTML
Enter your name: <input type="text"><br><br><br><br><br><br>
hi bobu,pls do check this
1.)u cant enter french.chinese through keybord, eventhough u try ,u cant
2.) u copy paste and take u r mopsue from textbox,that s it....
JavaScript
i=0;
$(document).ready(function(){
$("input").keypress(function(evt){
var charCode = (evt.which) ? evt.which : window.event.keyCode;
if (charCode <= 13)
{
return true;
}
else
{
var keyChar = String.fromCharCode(charCode);
var re = /^[a-zA-Z0-9!@#$%^&*()_+|}.\s{:"?><]$/
// alert(re.test(keyChar))
return re.test(keyChar);
}
}).blur(function(){
var val= $(this).val();
var regex = /^[a-zA-Z0-9!@#$%^&*()_+|}.\s{:"?><]+$/;
if(!regex.test(val)) $(this).val("")
});
});