我在我的网站上使用 jQuery,但在一个页面上有一个错误。
当 DOM 准备好时,我提交一个表单,如下所示:
jQuery.(document).ready(function() {
alert("test"); jQuery("#form").submit();
});
我的表格是这样的:
<form id="form" onsubmit="return false;" action="test.php"></form>
但是当我加载页面时,警报出现了两次。 所以最大的问题是提交两次的表单。
为什么dom会加载两次? 此错误仅在 IE(所有版本)上出现
谢谢
最佳答案
$(document).ready(function() {
alert("test");
$("#form").submit();
});
关于javascript - DOM 准备好两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4890249/