javascript - How to submit one html form to difference actions -


i have small form , links created this

<a href="#" onclick="document.selectform.submit();">contact</a> | <a href="#">message</a>  <form  name="selectform"  action="save.php" method="post" target="_blank">  name: <input type="text" name="test"/>        <input type="submit" value="submit" name="sub"/> </form> 

when click "contact" link, form submit correctly, , if click "message" link how set form submit url

for example: if click "message" link, want submit form edit.php , without using traget="_blank"

you can change form action using attr() method of jquery, example

$('#link1').click(function(){    $('#formid').attr('action', 'page1').submit(); });   $('#link2').click(function(){    $('#formid').attr('action', 'page2').submit(); }); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -