jquery - Pressing enter submits form but breaks accessibility -
i have html form. i'm intercepting activation of submit button need run javascript rather normal form submission.
i added javascript both pressing enter , clicking submit button activates form (i think normal practice). breaks accessibility. when user tabs button or link outside form , presses enter, button has focus aught activate. doesnt - form button gets activated instead. standard way of dealing (i feeling i'm missing fundamental here)?
simplified version of i'm using capture hitting enter (jquery)....
$("form").bind("keydown", function(e){ if (e.which == 13) { e.currenttarget.blur(); $("button").click(); return false; } });
intercept submit()
action instead, , use event.preventdefault()
cancel immediately:
$('form').on('submit',function(e) { e.preventdefault(); // more code });
Comments
Post a Comment