F.Joodaki F.Joodaki - 1 year ago 91
HTML Question

how to submit a form without input submit

I would like to submit a form without a input submit.

I want to submit this form after click on an

tag .

I have a form like 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">

I have an image like 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');

$('#submit_form').submit(); // not works at all


Answer Source

Please remove the space present at the end of your form id like:

id="submit_form "

change it to

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download