The checked most important concept about a property is that you have to remember that it has nothing to do with checked the state value, setting or setting the checked = "checked" checked = "true" property, and its state value true/false is
This example describes the use of attr () and prop () functions in jquery. Share to everyone for your reference, specific as follows:
attr () Method of jquery
jquery uses the attr () method to get and set element attributes, attr is the
Transferred from: http://hxq0506.iteye.com/blog/1046334Recently, in Iteye's news, jquery has been updated to 1.6.1. And the biggest change in previous versions is the addition of the. Prop method. But the. Prop () method and the. attr () method are
// Traverse option and add or remove Option
Function changeshipmethod (shipping ){
VaR Len = $ ("select [@ name = ishiptype] Option"). Length
If (Shipping. value! = "Ca "){
$ ("Select [@ name = ishiptype] Option"). Each (function (){
If ($ (this).
jquery has been updated to 1.6.1, added the. Prop method. But the. Prop () method and the. attr () method are literally difficult to distinguish. Both properties and attributes have the meaning of "attribute" in Chinese.The following is a brief
Usage One: $ (selector). attr (property name) Its function is to get the value of the specified property of the specified element (the $ (selector) portion). See Example:
Have such a section of HTML:
So what do you want to get to the address of
The difference between the prop and attr of jquery 1,. Prop (PropertyName) Gets the value 2,. Prop (PropertyName, value) that matches the property of the first element in the collection. Prop (map). Prop (PropertyName, function (index,
Do you know the difference between prop and attr? Some good examples are provided in this Article. Do not miss 1. prop (propertyName)
Obtains the Property value of the first element in the matching set.
2,
. Prop (propertyName, value)
. Prop (map)
.
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.