Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:46:27
Original
1095 people have browsed it

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>

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!