Update:

I finally figured out that "keypress" has a better compatibility than "keydown" or "keyup" on Linux platform. I just changed "keyup"/"keydown" to "keypress", so all went well.

I don't know what the reason is but it is solution for me. Thanks all who had responsed my question.

--

I have some codes that needs to detect key press event (I have to know when the user press Enter) with JQuery and here are the codes in Javascript:

j.input.bind("keyup", function (l) {
    if (document.selection) {
        g._ieCacheSelection = document.selection.createRange()
    }
}).bind("keydown", function(l) {
    //console.log(l.keyCode);
    if (l.keyCode == 13) {
        if(l.ctrlKey) {
            g.insertCursorPos("\n");
            return true;
        } else {
            var k = d(this),
            n = k.val();
            if(k.attr('intervalTime')) {
                    //alert('can not send');
                    k.css('color','red').val('Dont send too many messages').attr('disabled','disabled').css('color','red');
                    setTimeout(function(){k.css('color','').val(n).attr('disabled','').focus()},1000);
                    return
            }
    if(g_debug_num[parseInt(h.buddyInfo.id)]==undefined) {
            g_debug_num[parseInt(h.buddyInfo.id)]=1;
    }
        if (d.trim(n)) {
            var m = {
                to: h.buddyInfo.id,
                from: h.myInfo.id,
                //stype: "msg",
                body: (g_debug_num[parseInt(h.buddyInfo.id)]++)+" : "+n,
                timestamp: (new Date()).getTime()
            };
            //g.addHistory(m);
            k.val("");
            g.trigger("sendMessage", m);
            l.preventDefault();
            g.sendStatuses("");
            k.attr('intervalTime',100);
            setTimeout(function(){k.removeAttr('intervalTime')},1000);
            return
        }
        return
    }
}

It works fine

Edit
Report