The form is sent to FireFox when any button on the page is clicked.

The first time using Asp.net-mvc and the NerdDinner tutorial originally followed. My form submit button looks like this:

<p>
    <input type="submit" value="Save" />
</p>

Now I have added another button to the page with the jQuery code attached. It works in IE, but when I test FireFox, the form is submitted. I tried adding another button, this time without jQuery code attached, and the same thing happens. When the button is pressed, the form is submitted.

<button id="random-button">Do Nothing</button>

Why buttondoes a standard element submit a form in Firefox?

+5
source share
1 answer

, Firefox <button> .

 <button type="button" id="random-button">Do Nothing</button>

.

+21

All Articles