I saw a comment saying
It'd be better to set the "title" property with
.prop()
instead of.attr()
if you're using at least version 1.6 of jQuery.
Can someone explain why this is?
I saw a comment saying
It'd be better to set the "title" property with
.prop()
instead of.attr()
if you're using at least version 1.6 of jQuery.
Can someone explain why this is?
I guess you're familiar with the differences between prop
and attr
.
As the title
attribute is reflected by the title
property, there is actually no difference.
It depends.
prop
is used for getting properties of HTML objects
attr
is used for getting atttributes.
The prop documentation from jQuery explains it quite well.