I am create small demo for write persian text enter in text box.i am search some links and try this code but this is not enter persian text enter only english text so can you please help me how can do that.and also want to validation on national id.
this is my html text box :
<input type="text" id="txtn" onkeypress="text(this)">
this is my js code :
function text(name)
{
var name = $(name).val();
just_persian(name);
}
function just_persian(str) {
var p = /^[\u0600-\u06FF\s]+$/;
if (!p.test(str)) {
alert("not format");
}
}
here i am enter any text always getting alert.