How to change the href for a hyperlink using JQuery

Waqas Anwar
26 August 2014

You can use either attr or prop function depending upon the version of JQuery you are using. 

If you are using JQuery 1.5 or below then use attr function 
 $("a").attr("href", "");
If you are using JQuery 1.6 or above then use prop function 
$("a").prop("href", "");
The difference between prop and attr is that attr grabs the HTML attribute where as prop grabs the DOM property.