How do I change existing attribute's value with Javascript

I want to change some of the link block’s existing attribute values with the “if” condition in JS.
How can I do this one?


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hey !

You can use the setAttribute() method in JS.

Select your element, place the ‘‘if’’ condition and modify the attribute.

Check this link :

Thank you! it worked.