How to set the action value in the form form in jquery

Source: Internet
Author: User

From: http://blog.sina.com.cn/s/blog_495e3d130100puqa.html

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 who is familiar with JavaScript must know that JS can dynamically change the value of the action in the form, as follows:
Document.myForm.action = "userinfo.shtml";
Note that the form tag must have the name attribute, the light has an ID without name does not work

document.myform.attributes["Action"].value = "XXXXXXXX";
document.all ("Myformid"). SetAttribute ("Action", "value of action to be assigned");

Both of these methods are tested in JavaScript.

--------------------------------------------------------------------------------------------------
Here's how to set the value of an action in a form form in jquery.
$ ("#myFormId"). attr ("Action", "userinfo.shtml");
"Note": $ ("#myFormId"). action= "XXX"; This kind of writing is not working!

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.