Home >Web Front-end >JS Tutorial >Basic idea of ​​using jquery to modify the submission address of the form_jquery

Basic idea of ​​using jquery to modify the submission address of the form_jquery

WBOY
WBOYOriginal
2016-05-16 16:46:271142browse

Basic idea:

Get the jquery object of the corresponding form by using the jquery selector, and then use the attr method to modify the corresponding action

Sample program one:

By default, this The form will be submitted to page_one.html

After clicking the button, the form submission address will be modified to page_two.html

Copy code The code is as follows:




jquery test














<script> <br>var $fun = $(' button[name=update]'); <br>$fun.click(function(){ <br>$('form[id=qianshou]').attr('action','page_two.html'); <br>}); <br></script>


Sample program two:

The original action address of form is page_one.html, Directly modify it to page_two.html through jquery
Copy code The code is as follows:





jquery test





< form action="page_one.html" id="qianshou">





<script> <br>$('form[id=qianshou]').attr('action', 'page_two.html'); <br></script>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn