jquery $ (this). attr $ (this). Introduction to the use of Val method _jquery

Source: Internet
Author: User
$ (this). attr (key); Gets the value of the node property name, equivalent to the getattribute (key) method

$ (this). attr (key, value); Sets the value of a node property, equivalent to the setattribute (Key,value) method

Eg:<div id= "w_1" class= "widget" diywidgetid= "${template.diywidgetid}" ></div>

var Diywidgetid = $ (' #w_1 '). attr (' Diywidgetid '); Get the value of a node property

$ (this). Val (); Gets the value of an element node, equivalent to $ (this). attr ("value");

$ (this). Val (value); Set the value value of an element node, equivalent to $ (this). attr ("value", value);

Eg:<input id= "I_eg" value= "1" type= "text" ></input>

var i_eg=$ (' #i_eg '). Val (); Gets the value of an element node

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.