jQuery 1.6 prop() on div's title
Possible Duplicates:
.prop() vs .attr()
What is the differnece between doing
$('div').prop('title','whatever'); //set
$('div').prop('title'); //get
and
$('div').attr('title','whatever'); //set
$('div').attr('title'); //get
prop()
seems to behave the same as attr()
in the case of div attribute. I read the 1.6 documentation for this but i'm still a little confused.
THIS IS NOT EXACT DUPLICATE OF .prop() vs .attr(). This post doesn't answer the question. Please do not close it.
prop
and attr
do not always give different results. They only give different results when there is a difference between a property and an attribute.
For instance, with the checked
attribute/property:
$(':checkbox').prop('checked'); // returns boolean true false
$(':checkbox').attr('checked'); // returns string "checked" or undefined
This is all well explained on prop
vs attr
.
However, with the title
attribute/property, there is no difference. They are both strings, and setting one will set the other to that value.