jQuery实现enter回车事件

来源:互联网 发布:数据展示平台网页 编辑:程序博客网 时间:2024/05/21 10:35
<script>

$(function(){

//有三种:keydown,keyup,keypress

    $("#id").keydown(function(e){

      //13代表键值码

if((e.KeyCode || e.which)== 13){
      alert($(this).val());
    }
});
});
</script>