I have a form as follows:
<form action="saveorderdetails.php" id="submitForm" name="formsubmit" method="post">
<input type="hidden" id="ordertabledetailshidid" name="ordertabledetailshid">
<input type="hidden" id="datedetailshidid" name="datedetailshid">
<input type="hidden" id="customerdetailshidid" name="customerdetailshid">
</form>
and I have a div as follows: In that div I have a onclick()
, which is used to submit the form.
<a href=""><div class="icon_boundary2" onclick="btn_save_click();"><i class="fa fa-check" style="font-size:20px;padding:4px 0px 5px 5px; color:#7298CD;"></div></a>
My javascript function as follows:
function btn_save_click(){
document.getElementById("submitForm").submit();
}
But the page is not getting submitted. Instead it is reloading. I have tried all the alternatives like:
document.getElementById("submitForm").submit();
But none of them working!!
Just remove the anchor tag. This is how it should look like :
<div class="icon_boundary2" onclick="btn_save_click();"><i class="fa fa-check" style="font-size:20px;padding:4px 0px 5px 5px; color:#7298CD;"></div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.