I have two HTML buttons; one submits a form and one closes the container dialog. The button closing it doesn’t have a type attribute:
<button type="submit">Submit</button>
<button class="closeDialog">Close</button>
The JavaScript is as follows:
$(".closeDialog").live("click", function(event) {
event.preventDefault();
$(this).parents(".dialog").dialog("close");
});
$("form.myClass").live("submit", function(event) {
event.preventDefault();
// submits the form here . . .
});
All of this works well in every browser but IE. In IE, when one clicks the “Close” button, both JavaScript events above execute, but only the .closeDialog event handler should.
IE seems to treat a element as a submit button, regardless of its type attribute.
How can one get around this misinterpretation in IE?
On the second one, try :
<button type="button">