Form submits in FireFox when any button on page is clicked
First time using Asp.net-mvc and originall开发者_Python百科y followed the NerdDinner tutorial. My form submit button looks like this:
<p>
<input type="submit" value="Save" />
</p>
I've now added another button to the page with jQuery code attached. It works in IE, but when I test in FireFox the form submits. I tried adding another button, this time with no attached jQuery code and the same thing happens. When the button is clicked, the form submits.
<button id="random-button">Do Nothing</button>
Why does the standard button
element submit the form in Firefox?
I recall that Firefox defaults a <button> to a submit button. If you use
<button type="button" id="random-button">Do Nothing</button>
it should solve your problems.
精彩评论