Javascript Submit() Is Not Submitting The Form May 30, 2024 Post a Comment This is my code. HTML use the onsubmit to disable the button instead of using weird inline handlers. There is no href on a button for exampleYou should not disable a button you need to click before clicking itLike this:<formid="add_new_video"method="post"class="appnitro"style="margin-left:70px;"action="<?phpecho base_url()?>videos/save"><inputtype="text"name="name"><buttontype="submit"id="buttonSub"class="dark_text_link">Add New Video</button></form>Copyusingwindow.onload=function() { document.getElementById("add_new_video").onsubmit=function() { document.getElementById('buttonSub').disabled = true; setTimeout(function(){document.getElementById('buttonSub').disabled = false;},1000); } } CopyYou 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 elsewhereSolution 2: Replace button with this tag element.<inputtype="submit"class="dark_text_link" disabled id="btnsubmit" href="javascript:void(0);" onclick="return addVideo();"/> Copy Share Post a Comment for "Javascript Submit() Is Not Submitting The Form"
Post a Comment for "Javascript Submit() Is Not Submitting The Form"