Input回车事件



function onKeyPress(e) {

    var keyCode = null;

    if(e.which)
        keyCode = e.which;

    else if(e.keyCode)
        keyCode = e.keyCode;

    if(keyCode == 13) {
        search();
        return false;
    }
    return true;
}

function search(){

   console.log(1)

}
 

你可能感兴趣的:(Input回车事件)