如果未发布表单,我正在使用 jQuery 显示消息,使用以下技术:
$(window).bind("beforeunload", function()
{
form = ... // how to access the submitted $("#form")?
// here is code to check if form values have changed
return "Are you sure you want to leave this page without saving (submitting the form)?"
}
由于 $(this) 显然是窗口元素,我怎样才能找出页面上试图提交的表单(如果提交了表单)?
谢谢。