var sliv = {}; sliv.currentLocaleCode = ''; sliv.foreignAlphabetLocales = ['GR', 'RU']; sliv.preventCutPasteInInputs = function(){ $('input').die('copy paste ').live('copy paste ', function (e) { e.preventDefault(); }); }; sliv.forceCharsetOnForms = function(charset){ $('form').attr('accept-charset', charset) }; function disableKeyboard(){ $('input').die('copy paste ').live('copy paste ', function (e) { e.preventDefault(); }); } $(document).ready(function(){ $('input').live('keyup',function(e){ var stringa =$(this).val(); //cirillic var patt = /[а-яА-Я]/g; //greek var patt2 = /^[α-ωΑ-Ω\s]*$/g; if(patt.test(stringa) || patt2.test(stringa) ){ $(this).val(""); //disableKeyboard(); } }); if(sliv.foreignAlphabetLocales.indexOf(sliv.currentLocaleCode) != -1){ sliv.preventCutPasteInInputs(); sliv.forceCharsetOnForms("UTF-8"); } });