input輸入框回車事件響應


1.常用方法

  
1.方法1
$('#applyCertNum').bind('keypress',function(event){ if(event.keyCode == 13) { alert('你輸入的內容為1:' + $('#applyCertNum').val()); } });
  2.方法2 $(
'#applyCertNum').on('keypress',function(event){ if(event.keyCode == 13) { alert('你輸入的內容為1:' + $('#applyCertNum').val()); } });
  3.方法3 $(
'#applyCertNum').bind('keypress',function(event){ if(event.keyCode == "13") { alert('你輸入的內容為2:' + $('#applyCertNum').val()); } });
4.方法4
$("#applyCertNum").keydown(function(e) { if (e.keyCode == 13) { alert("12345...."); } });

 

2.HTML 

<tr>
                        <th>身份證賬號:</th>
                        <td><input id="applyCertNum" type="text" name="applyCertNum" style="width:310px;"
                             data-options="required:true"></input></td>
                    </tr>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM