Dom'sattribute and propertyToday to talk about a small JS topic, is the DOM node attribute and property differences, this point looks very small, actually behind the Shia. If the interview is a front-end, listen to his understanding of the problem,
Property vs. AttributeBefore we begin formally comparing the two jquery methods of Prop () and attr (), it is necessary to understand the meaning of the property and the attribute two words first. In Chinese, they are all the meanings of attributes,
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
Today, when using the pull-down menu in a project, use the Juery action to make the page load the menu defaults to the selected value of 2, my first operation is as follows:
1
2
3
/**js part **/
I am optimistic about the perfect,
"To summarize yourself, see the transcript below for details":attr () is used to manipulate HTML properties, and the prop () property is used to manipulate DOM properties①: In many cases, it can be interoperable②:attr () for cases where custom HTML
1.attr (): The default is to save the browser's initial value prop () Save the updated value2. The following is the first usage, but the. attr () method can run in all attributes cases.Note: The properties of some DOM elements are also listed below,
jQuery1.6 adds a new prop method that looks and uses the same as the attr method, what is the difference between these two methods? This is from the HTML attribute and property differences, attr and prop is the abbreviation for these two
jQuery1.6 adds a new prop method that looks and uses the same as the attr method, what is the difference between these two methods? This is from the HTML attribute and property differences, attr and prop is the abbreviation for these two things.
prop and attr interfacesIn the experiment, in the jquery1.7 version, attr ("value") and the Val () interface get the value of the input control, which is consistent and is the current control value.However, the jquery1.11 version has separated the
The attr and prop of jqueryjQuery1.6 adds a new prop method that looks and uses the same as the attr method, what is the difference between these two methods? This is from the HTML attribute and property differences, attr and prop is the
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.