[英]Simulate Enter press key without specifing the element
我嘗試了sendkeys插件和其他。
有沒有一種方法可以模擬沒有元素按下的Enter鍵?
$("div.myclass").click(); // Put focus on my element - works
$("div.myclass span").sendkeys("Test"); // using sendkeys plugin send the input - works.
setTimeout(function(){
console.log('trigger');
//$("div._1mf").trigger({type: 'keydown', key: 'enter'}); // this one just insert new line...
e = jQuery.Event("keypress")
e.which = 13
$("div.myclass").keypress(function(){ // this one doesn't work
}).trigger(e)
},2000);
我已經聚焦了元素並插入了輸入,我只需要模擬Enter鍵來發送文本,該怎么辦?
我認為您可能想要做的是,提交您的輸入所駐留的表單?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.