javascript - jQuery hotkeys plugin to submit a form not working when in an input -
I have a page with a group of small forms, I assign a hotkey dynamically to submit each form The code you want to see looks like this:
HTML ... Such other small variations with a specific ID related to hotkey ... jQuery Simple is right? But there are also many text inputs on the page and if the user is typing into one of those fields and hits one of the hotkeys, this same form is not submitted and in fact if there is something for the hotkey browser Control-like is the Save dialog shown, with any idea how can I prevent it from happening? I think the input is being captured by the hotkey incident and then instead of the blocked form directly Try adding an event to the event.
& lt; Form: form id = "formCtrl" action = "review.html" & gt; & Lt; Input name = "id" type = "hidden" value = "" /> & Lt; / Form: Form & gt; & Lt; Form: form id = "formCtrls" action = "save.html" & gt; & Lt; Input name = "id" type = "hidden" value = "" /> & Lt; / Form: Form & gt;
$ ('[id = "formCtrl"]). Each (function () {var me = $ (this); var myId = me.attr ("id"); var key binding = MyId.replace ("form", "") .replace (/ (. {4} $ (Document) .bind ('keydown', key binding, function (evt) {evt .stopPropagation (); evt.preventDefault (); $ ("#" + myId) Submit (); Returned;});});
Comments
Post a Comment