javascript - Form not submitting when clicking submit button -
i added javascript validation form on website. site connects db fine, when click on submit button, no action taken.
this form located in footer of page:
<div id="add_restaurant" class="full-shadow"> <h4>add restaurant</h4> <form name="submitform" action="<?php echo $pagename ?>" method="post"> <ul class="radio_list" id="category"> <li>category:</li> <li><label class="radiobtn"><input name="category" type="radio" value="healthy" id="is_healthy" checked="checked"/>healthy</label></li> <li><label class="radiobtn"><input name="category" type="radio" value="unhealthy" id="is_unhealthy"/>unhealthy</label></li> </ul> <br /> <label>name:</label> <input name="rest_name" id="rest_name" type="text" autocomplete="off"/> <input id="submit" type="submit" name="submit" value="submit"> </form> <p id="add_thanks"></p> </div>
i imagine problem simple i'm over-looking. can help?
edit: i've found issue here in js validation:
$('#submit').off('click').on('click', function(){ if($('#rest_name').val() === ""){ $('#add_thanks').html("please type in restaurant name."); } return false; });
if disable code, form works. causing problem in javascript code?
you not printing $pagename:
<form name="submitform" action="<?php echo $pagename ?>" method="post">
Comments
Post a Comment