/    Sign up×
Community /Pin to ProfileBookmark

Change the style of all links

Hello all,

Is it possible to change the style of all the links (<a>) in the page at once, using JS?

It is possible using DOM walk – finding the elements and changing their class/style. But is there a simpler way?

thank you, ?

Rami

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CharlesMay 05.2005 — What could possibly be easier than a DOM walk? &lt;script type="text/javascript"&gt;
&lt;!--
function highlightLinks () {
var l, i = 0;
while (l = document.links[i++]) {l.clasName = 'highlight'}
}
// --&gt;
&lt;/script&gt;
Copy linkTweet thisAlerts:
@ramiab1authorMay 05.2005 — It is pretty easy.

thank you.

Rami
×

Success!

Help @ramiab1 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...