[英]Trigger the textarea message when clicking on href link
我正在尝试在wordpress网站上自定义对讲插件。 单击href链接时,我需要触发一条消息,(因此在textarea上模拟Enter键)。
这是使用的代码:
jQuery('body').on('click', '.start-chat-btn-advice', function () {
var e = jQuery.Event("keydown");
e.which = 13;
jQuery("textarea").trigger(e);
});
听起来你需要
<form action="chat" id="form1">
<div id="container">
<textarea id="chatText"></text>
<a href="#" class=".start-chat-btn-advice">Click</a>
</div>
</form>
$(function() {
$("#container").on("click",".start-chat-btn-advice",submitIt);
$("#chatText").on("keydown",function(e) {
if (e.which==13) submitIt()
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.