【发布时间】:2013-11-29 07:34:41
【问题描述】:
这是 sindhuri,我在 Google Chrome 控制台中收到以下警告: event.returnValue 已弃用。请改用标准 event.preventDefault()。 我正在使用的 jquery1.9.1 版本。
<script>
window.jQuery(document).ready(function () {
window.jQuery('#hideshow').click(function () {
window.jQuery('#message').toggle(function () {
window.jQuery('#hideshow').text('Show');
window.jQuery('#message').hide();
alert("message hide succeesfully");
}),
function () {
window.jQuery('#hideshow').text('Hide');
window.jQuery('#message').show();
alert("message show succeesfully");
}
});
});
</script> <a href="#" id="hideshow">Hide</a>
BeforeUnloadEvent 有一个 returnValue 属性。在事件处理程序中将 returnValue 设置为非空字符串会导致用户代理要求用户确认他们希望卸载文档。这相当于在 EventHandler 中返回一个非空字符串
【问题讨论】:
标签: jquery