这是我的代码。Javascript提交()不提交表格
HTML
<form id="add_new_video" method="post" class="appnitro" style="margin-left:70px;" action="<?php echo base_url()?>videos/save">
<input type="text" name="name">
<button type="submit" class="dark_text_link" disabled id="submit" href="javascript:void(0);" onclick="return addVideo();">Add New Video</button>
</form>
而且JS是
function addVideo() {
//disables the onclick event of the element for 1 seconds
document.getElementById('submit').disabled = true;
setTimeout(function(){document.getElementById('submit').disabled = false;},1000);
document.getElementById('add_new_video').submit();
}
当我点击提交按钮,该按钮获取第二禁用和重新出现,但形式不提交。我仍然是JavaScript的新手,所以可能有我忽略的东西。任何想法 ?
,一定不要调用任何形式的元素名称或ID =“提交” – mplungjan
见我的回答当然这是不正确的...... – mplungjan