I am attempting to use jQuery's .delegate() function to catch a submit button press and prevent the page from being reloaded.
It works fine in every browser I have tried, but Internet Explorer!
Let me explain in code, I have this HTML which is dynamically generated by JS:
<form id='submit-form'>
<input type='text' id='blah' />
<input type='submit' id='blahbutton' />
</form>
My Javascript looks like this:
$("body").delegate("#submit-form", "submit", function(event)
{
// to logic here
return false;
});
When typing in the text box and using the 'Enter' keyboard button, it performs the JS fine and the page stays as-is. But when the Submit button is clicked with the mouse, it reloads the page and submits the form.
How can I make it so clicking the button does the same as pressing enter on the input on Internet Explorer?