javascript - how to submit a form without input submit -


i submit form without input submit.

i want submit form after click on img tag .

i have form this:

 <form name="form-form"  action="http://localhost/php/enteqal-ax.php" method="post" id="submit_form ">      <input type="hidden" id="value1" name="value_php">  </form> 

i have image this:

 <img id="img" width="100px" height="100px" src="http://www.shadyab.com/assests/images/upload/thumb_open-menu-roko-restaurant_(17)3.jpg"> 

my java script code :

     $('#img').click(function() {    var img_src = $('#img').attr('src');     $('#value1').val(img_src);    $('#submit_form').submit(); // not works @   }); 

please remove space present @ end of form id like:

id="submit_form " 

change

id="submit_form" 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -