What is the difference between properties and attributes in HTML?

后端 未结 5 1591
我寻月下人不归
我寻月下人不归 2020-11-21 06:10

After the changes made in jQuery 1.6.1, I have been trying to define the difference between properties and attributes in HTML.

Looking at the list on the jQuery 1.6.

5条回答
  •  不要未来只要你来
    2020-11-21 06:55

    well these are specified by the w3c what is an attribute and what is a property http://www.w3.org/TR/SVGTiny12/attributeTable.html

    but currently attr and prop are not so different and there are almost the same

    but they prefer prop for some things

    Summary of Preferred Usage

    The .prop() method should be used for boolean attributes/properties and for properties which do not exist in html (such as window.location). All other attributes (ones you can see in the html) can and should continue to be manipulated with the .attr() method.

    well actually you dont have to change something if you use attr or prop or both, both work but i saw in my own application that prop worked where atrr didnt so i took in my 1.6 app prop =)

提交回复
热议问题