-1
嗨,我使用的是ajax聊天,如果我们点击输入它触发提交按钮。如果我们点击输入按钮一次没有问题。如果我们长按回车按钮重复提交通话和聊天信息保存多个times.please帮助在这个问题上 示例jQuery代码:如何防止聊天中的长输入按钮问题
$("#chat_message").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
$("#send-btn").click();
return false;
}
});
的html代码:
<input type="text" name="message" id="chat_message" >
<button type="button" id="send-btn">Send</button>
同时检查的'$值( “#chat_message”)'上KEYUP – Rayon
改用按键 – cheralathan
@cheralathan请检查html代码keyup不适用于这种情况。我检查它不工作 –