标签:input exp 输入 ret replace change rem content 表情
oninput input/textarea 监听输入状态
function filteremoji(content){
var ranges = [
‘\ud83c[\udf00-\udfff]‘,
‘\ud83d[\udc00-\ude4f]‘,
‘\ud83d[\ude80-\udeff]‘
];
emojireg = content .replace(new RegExp(ranges.join(‘|‘), ‘g‘), ‘‘);
return emojireg;
}
$("input,textarea").on(‘input propertychange‘,function(){
var content=$(this).val();
var ranges = [
‘\ud83c[\udf00-\udfff]‘,
‘\ud83d[\udc00-\ude4f]‘,
‘\ud83d[\ude80-\udeff]‘
];
emojireg = content .replace(new RegExp(ranges.join(‘|‘), ‘g‘), ‘‘);
$(this).val(emojireg);
})
标签:input exp 输入 ret replace change rem content 表情
原文地址:http://www.cnblogs.com/lvzhihui/p/7291167.html