Javascript jquerysubmit有两个键 搜索 清楚的
我有以下标签。当我点击链接时,页面会重新加载。 如何使用jquery通过按Alt+Enter在该链接上执行命令 试试看:Javascript jquerysubmit有两个键 搜索 清楚的,javascript,jquery,jsf,Javascript,Jquery,Jsf,我有以下标签。当我点击链接时,页面会重新加载。 如何使用jquery通过按Alt+Enter在该链接上执行命令 试试看: <h:commandLink action="list?faces-redirect=true&includeViewParams=true" id="search">Search </h:commandLink> <h:link outcome="/ad
<h:commandLink action="list?faces-redirect=true&includeViewParams=true"
id="search">Search
</h:commandLink>
<h:link outcome="/admin/clients/list.xhtml" styleClass="btn btn-default ml15" id="clear">
Clear
</h:link>
现场演示:您试过吗?是的,一键可用。但是有两个不起作用,你能编辑你的问题并添加你尝试过的内容吗?
var cmdLnk = $('#search');
$(document).keydown(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (e.altKey) {
if (code === 13) {
/* Since 'commandLink' renders as an 'anchor' tag (link)
* I assume that you will be able to trigger 'click' event.
* However, your question title says to 'submit' with two keys
* and, if this is the case, you can replace this last line and
* use '$(form).submit()' instead.
*/
cmdLnk.click();
}
}
});