How to javascript submit in the presence of an input id equal to 'submit'
问题 I've been binding submit events to forms, and ensuring that they do not break the form, using jQuery like this: jQuery('form').submit(function(e){ var form = this; e.preventDefault(); alert('1'); setTimeout(function() { alert('2'); form.submit(); }, 1000); }); This is all good and well, except, if for some reason a front end developer gave a child input of this form an id of ="submit", this breaks, as form.submit() throws a JavaScript error (In Chrome, 'Uncaught TypeError: Property 'submit'