If I have the following view, how can I select the submit button based on the form identifier that will be used for the click event?
<form id="login"> <input type="text" name="email"> <input type="text" name="password"> <input type="submit" name="submit"> </form>
Something like the following works, but it can't just be input[name=submit] , because there can be more than one on a page.
$('input[name=submit]').click(function (e) { e.preventDefault(); console.log('clicked'); });
source share