I am having trouble changing the href attribute of my HTML code using Jquery
My HTML code is
<div id="main-logo"><a href="http://local.winemag.com"></a></div>
I am using the following JQuery code to change my link but for some reason it's not working.
$("#main-logo a[href]").attr('href', 'http://www.test.com/');
to get the current value of the href based on the code provided
$("#main-logo a").attr("href");
to set the href new value would be
$("#main-logo a").attr("href","http://www.test.com/");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With