Javascript Submit does not include Submit Button Value Javascript Submit does not include Submit Button Value javascript javascript

Javascript Submit does not include Submit Button Value


Yes, that is the correct behavior of HTMLFormElement.submit()

The reason your submit button value isn't sent is because HTML forms are designed so that they send the value of the submit button that was clicked (or otherwise activated). This allows for multiple submit buttons per form, such as a scenario where you'd want both "Preview" and a "Save" action.

Since you are programmatically submitting the form, there is no explicit user action on an individual submit button so nothing is sent.


Using a version of jQuery 1.0 or greater:

$('input[type="submit"]').click();

I actually was working through the same problem when I stumbled upon this post. click() without any arguments fires a click event on whatever elements you select: http://api.jquery.com/click/


Why not use the following instead?

<input type="hidden" name="submitDocUpdate" value="Save" />