retrieve class names using .attr("class") or .prop("class")
My script will dynamically add or remove the classes for an element. I tried to get the class names for this element.
1. which method should I use? $ele.attr('class") or $ele.prop("class"). Both of them seemed working. But I feel confused.
2. As I searched around and found that attribute is initial state for attributes which means the $ele.attr("class") should not be changing if I add or remove classed for this element.
I used jquery 1.10.2
Thank you.