$(function(){ $("textarea").keyup(function(){ var pattern = new RegExp('[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f ]'); if ($(this).val() != "" && $(this).val() != null) { if (pattern.test($(this).val())) { var rs = ""; for (var i = 0; i < $(this).val().length; i++) { rs = rs + $(this).val().substr(i, 1).replace(pattern, ''); } $(this).attr("value", rs); } } }); $("textarea").blur(function(){ var pattern = new RegExp('[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f ]'); if ($(this).val() != "" && $(this).val() != null) { if (pattern.test($(this).val())) { var rs = ""; for (var i = 0; i < $(this).val().length; i++) { rs = rs + $(this).val().substr(i, 1).replace(pattern, ''); } $(this).attr("value", rs); } } }); })