使用 jQuery.Trigger 发送/打印密钥
我想我已经阅读了谷歌知道的包含这些关键字的每一页,但没有任何内容对我有用。
我拥有的是一个表单输入,旁边有一个按钮[不提交],我想要的是单击按钮来触发“输入”键单击。 [这将分别运行另一个已经在工作的函数..]
我已经尝试过
<input id='inputBtn' type='button' .... onclick='$('#otherInput').trigger('keypress',[13]);' >
并将其放入一个函数中,然后从 onclick 运行它,或者
$('#inputBtn').click(function().....
对我不起作用,请帮助!
i think i have read every page google knows about which has these keywords, and nothing works for me.
what i have is a form input, and a button next to it [not submit], and what i want is for the button click to trigger an 'enter' key click. [this will respectively run another function which is already working..]
i've tried
<input id='inputBtn' type='button' .... onclick='$('#otherInput').trigger('keypress',[13]);' >
and also putting it in a function and then running it from onclick, or making a
$('#inputBtn').click(function().....
nothing works for me please help!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
--编辑--
你可能想用
等等来扩展它。
--EDIT--
you might want to extend that with
etc.
您可能需要提供一些示例代码。我想不出有什么理由不能让按钮上的单击事件调用第二个函数(按下 Enter 键时运行)。
应该有效。
You might need to provide some example code. I can't think of any reason you couldn't just have the second function (that runs when enter is pressed) being called by the click event on your button.
Should work.