Javascript 点击等待,然后发布表单
我正试图用ONClick提交一份表格。但是,我希望Onclick在继续提交之前等待1秒。我试图实现这一点,但表单现在根本没有提交 代码:Javascript 点击等待,然后发布表单,javascript,jquery,Javascript,Jquery,我正试图用ONClick提交一份表格。但是,我希望Onclick在继续提交之前等待1秒。我试图实现这一点,但表单现在根本没有提交 代码: (无法直接发布代码,因此不会提交问题)您正在将事件绑定到表单单击事件。尝试添加另一个按钮并将事件附加到该按钮 <form action="voteupdate.php" id="form-id" method="post"> <input type="hidden" name="type" id="type" value="' . $
(无法直接发布代码,因此不会提交问题)您正在将事件绑定到表单单击事件。尝试添加另一个按钮并将事件附加到该按钮
<form action="voteupdate.php" id="form-id" method="post">
<input type="hidden" name="type" id="type" value="' . $type . '">
<input type="hidden" name="id" id="id" value="' . $id . '">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default '.$vup.'">
<input type="radio" name="vote" id="1" value="1">
<span class="glyphicon glyphicon-chevron-up"></span> Vote up
</label>
<label class="btn btn-default '.$vd.'">
<input type="radio" name="vote" id="2" value="2">
<span class="glyphicon glyphicon-chevron-down"></span> Vote down
</label>
</div>
<input type="button" value="Submit" onclick="setTimeout(function(){ document.getElementById('form-id').submit(); }, 1000)" />
</form>
投票赞成
否决
很抱歉,onclick结尾处有一个额外的}
,就在“
之前。请在我更新代码时将其删除。