Reputation: 125
I am trying to replace a link with a var but the page being loaded is example.com/$NewLink instead of the value of the variable, I am sure this has been asked already but I could not seem to strum up the answer.
Current Code:
$('[href="Link"]').attr('href', '$NewLink');
Thanks
Upvotes: 1
Views: 32
Reputation: 26180
$NewLink is a variable, not a string. Remove the quotes:
$('[href="Link"]').attr('href', $NewLink);
Upvotes: 2