Reputation: 7092
I have the following Jquery code that works great inside my .aspx page using FF or Chrome. However, in IE9, when I click on the button that is supposed to open the dialog box, it just seems to refresh the entire page and nothing happens.
I am using these versions:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
Here is my jquery:
$(function () {
$("#btnSearch").click(function () {
$("#gvBox").show();
});
$("#dialog-form").dialog({
autoOpen: false,
height: 400,
width: 650,
modal: true,
buttons: {
"Transfer": function () {
var bValid = true;
allFields.removeClass("ui-state-error");
if (bValid) {
$(this).dialog("close");
}
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
allFields.val("").removeClass("ui-state-error");
},
open: function () {
{
$(this).parent().appendTo($("form:first"));
}
}
});
$("#btnTransfer").button().click(function () {
$("#dialog-form").dialog("open");
return false;
});
return false;
});
And here is my button that opens the dialog box:
<button id="btnTransfer">Transfer Ownership</button>
Are there any tricks to getting this to work with IE?
Upvotes: 2
Views: 4376
Reputation: 2747
Try this:
$("#btnTransfer").button().on('click', function (e) {
e.preventDefault();
$("#dialog-form").dialog("open");
});
...instead of return false;
Upvotes: 2