<form method="POST" name="form" id="form">
<p>
<input type="radio" name="ans1" value="A"> <br>
<input type="radio" name="ans2" value="B"> <br>
<input type="radio" name="ans3" value="C"> <br>
<input type="radio" name="ans4" value="D"> <br>
<input type="submit" name="send">
</p>
</form>
$(document).ready(function()
{
if(endTime <= time )
{
//alert('123'); //when fire condition then alert is working ;
$("form").submit();
}
});
When i click on send button then form submit by php
but if form does not submit i want to submit form automatic by jQuery ,
Because when you call $( "#form" ).submit(); it triggers the external submit handler which prevents the default action, instead use
$( "#form" )[0].submit();
or
$form.submit();//declare `$form as a local variable by using var $form = this;
When you call the dom element's submit method programatically, it won't trigger the submit handlers attached to the element
Try submitting the form using javascript if it works :
$(document).ready(function()
{
if(endTime <= time )
{
//alert('123'); //when fire condition then alert is working ;
document.getElementById("form").submit()
}
});
And secondly, it's not a good practice to name a form form
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.