3

Behold the following HTML form:

<form id='bla'>
<input type='hidden' name='submit' value='submit'>
</form>
<button onclick='document.getElementById("bla").submit()'> OK </button>

Clicking the button does not submit the form, because form.submit is now the input element named 'submit', rather than the form's submit function.

If the input element in the above example is named otherwise (e.g. name='foobar') it works just fine.

I'm dealing with a context where I need to send along a value called 'submit' when submitting a form. How do I submit this form from JavaScript?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.