Link to home
Create AccountLog in
Avatar of jrattinger
jrattinger

asked on

javascript - replace anchor href value

Hi,

I need help to replace a href link of an anchor tag using javascript.

see below for current html and desired html

i have tried the following jquery statement, but no luck.

any pointers would be much appreciated!

Thanks,
John
existing html:

<a href="https://checkout.netsuite.com/app/common/item/itemsordered.nl" class="dottedlink">Re-Order Items</a>

Desired Html:
<a href="https://checkout.netsuite.com/app/accounting/transactions/quickfindlist.nl?findtype=salesord" class="dottedlink">Re-Order Items</a>

Open in new window

$('a[href="https://checkout.netsuite.com/app/common/item/itemsordered.nl"]').href= "https://checkout.netsuite.com/app/accounting/transactions/quickfindlist.nl?findtype=salesord";

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of CyberGhost
CyberGhost
Flag of Czechia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of jrattinger
jrattinger

ASKER

thanks for your help. by setting the "attr" as in your example, my code worked perfectly.

Unfortunately, that html is generated by the system i'm working with, thus I can't add an Id. i did narrow the selector a little but though.