1. 程式人生 > >手機端輸入框過濾表情JS程式碼

手機端輸入框過濾表情JS程式碼

function filteremoji(content){
        var ranges = [
            '\ud83c[\udf00-\udfff]',
            '\ud83d[\udc00-\ude4f]',
            '\ud83d[\ude80-\udeff]'
        ];
        emojireg = content .replace(new RegExp(ranges.join('|'), 'g'), '');
        return emojireg;
    }

  if(filteremoji($.trim($('#other textarea').val()))) return true;