HTML:
<form target="" method="post">
<input name="username" type="text" />
<input name="password" type="password" />
<button>Cancel</button>
<input type="submit" />
</form>
Fiddle: http://jsfiddle.net/n9Lpcqyr/
Problem: When I hit enter, both buttons get triggered. Tested with this jQuery:
$('button').click(function(){
alert('help');
});
$("form").submit(function(){
alert('hey');
});
Because the first <button>
is mapped to .remove()
the dialog, the form no longer exists to be submitted. I know I can bind the enter key to the input
s with js, but I'm looking for an HTML-only solution. I tried tabindex
with no luck. What else can I do?