[jquery Method Prop (NAME|PROPERTIES|KEY,VALUE|FN)] This method operates the property of the element itself

Source: Internet
Author: User

Gets the property value of the first element in the matching element set or sets one or more properties for each matching element (operates in a similar manner to attr):

With some built-in properties for DOM elements or window objects, the browser may produce an error if the property is attempted to be deleted. jquery first assigns a property of the undefined value, ignoring any errors generated by the browser

If the second argument is callback, then the property value needs to be returned, and the function argument is interpreted as follows:

1: Property name

2: function that returns the value of the property, the first parameter is the index value of the current element, and the second argument is the original property value

Instance:

<! DOCTYPE html>#listDemo {List-Style:none;} #listDemo li{width:350px;height:20px;margin:10px0;background:red;text-align:center;font:400 13px/20px ' Courier New '; color: #FFF;} </style><script type= ' Text/javascript ' >    $(function(){        $(' #user '). Prop (' AutoComplete ',function(index,oldattr) {alert (oldattr);    }); });</script>

[jquery Method Prop (NAME|PROPERTIES|KEY,VALUE|FN)] This method operates the property of the element itself

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.