The implementation method of setting action values in form forms in jquery _jquery

Source: Internet
Author: User

HTML code:

<form id= "Myformid" name= "MyForm" action= "" method= "post" > <input type= "hidden" id= "Inparam" Name= "
 Inparam "/> <input type=" hidden "id=" Tstype "name=" Tstype "/> <input" type= "hidden" id= "Zd" name= "
 Zd "/>
</form>

A friend familiar with JavaScript must know that JS can dynamically change the value of the action in form forms as follows:

Document.myForm.action = "userinfo.shtml";  

Note that the form label must have the name attribute, the light has ID no name does not function

document.myform.attributes["action"].value = "XXXXXXXX";

document.all ("Myformid"). setattribute ("Action", "value of the action to be assigned");

Both of these methods have been tested in JavaScript.

--------------------------------------------

Here's how to set the value of the action in form forms in jquery.

$ ("#myFormId"). attr ("Action", "userinfo.shtml");

"Note":$ ("#myFormId"). action= "XXX"; This kind of writing is not working!

In this jquery set form form in the implementation of the action is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.