このコードが IE で機能しないのはなぜですか? 正しく機能させるにはどうすればよいですか?次のコードは、Firefox、Chrome、および Opera で予期される jQueryUI モーダル ポップアップ ダイアログを生成します。ただし、Internet Explorer では失敗します。
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<script language="JavaScript">
$(document).ready(function() {
console.log( "ready!" );
$("#link1").on("click", function(e) {
var link = this;
e.preventDefault();
$("<div>Are you sure you want to continue?</div>").dialog({
buttons: {
"Ok": function() {
window.location = link.href;
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
});
});
</script>
<a id="link1" href=http://google.com>test link</a>
</body>
</html>