با استفاده از جی کپوری یا هر کتابخانه از حاوا اسکریپت می توانید به راحتی این کار را انجام دهید.
یا طرف سرور با کمک لینک های زیر انجام دهید.
https://stackoverflow.com/questions/...acter/15203555
https://stackoverflow.com/questions/...-of-characters
https://stackoverflow.com/questions/...t-using-jquery
درحالت کلی با regulare می تونی انجام بدی نمونه کد رو ببین
کد HTML:<input id="txt-box1" type="text" /> <input id="txt-box2" type="text" /> <input id="txt-box3" type="text" /> <textarea></textarea>کد HTML:$.fn.restrictInputs = function(restrictPattern){ var targets = $(this); var pattern = restrictPattern || /[\a-z+0-9]/// some default pattern var restrictHandler = function(){ var val = $(this).val(); var newVal = val.replace(pattern, ''); if (val !== newVal) { // To prevent selection and keyboard navigation issues $(this).val(newVal); } }; targets.on('keyup', restrictHandler); targets.on('paste', restrictHandler); targets.on('change', restrictHandler); }; $('input, textarea').restrictInputs();





پاسخ با نقل قول