This is my code.
HTML
Several things
Like this:
<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" id="buttonSub" class="dark_text_link">Add New Video</button>
</form>
using
window.onload=function() {
document.getElementById("add_new_video").onsubmit=function() {
document.getElementById('buttonSub').disabled = true;
setTimeout(function(){document.getElementById('buttonSub').disabled = false;},1000);
}
}
You do not actually need to ENABLE the form button again since you submit to the same page. The button will be enabled when the page reloads - this is of course not true if you target the form elsewhere
Replace button with this tag element.
<input type="submit" class="dark_text_link" disabled id="btnsubmit" href="javascript:void(0);" onclick="return addVideo();"/>