Thomas R Alexander

Manager, Developer, and professional problem solver

jQuery .prop(“href”) vs .attr(“href”)

jQuery .prop(“href”) is not equal to jQuery .attr(“href”)

The difference between prop and attr is that attr grabs the HTML attribute where as prop grabs the DOM property.


Be careful in your decision to use attr for referencing an href. 99% of the time, you probably want to use prop.

Leave a Reply

Your email address will not be published. Required fields are marked *.

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">