Skip to content Skip to sidebar Skip to footer

Javascript Function - Change The Color Of Text

I have to make a function called tousVerts ('everythingGreen' in French) that will change the color of all the text I need on the page to green. This text is between tags EM or A i

Solution 1:

You need to use document.getElementsByTagName since it returns multiple elements:

var tousVerts = document.getElementsByTagName (elt);

Also, tousVerts[0]; is not needed:

var tousVerts = function(elt) {
var tousVerts = document.getElementsByTagName (elt);
tousVerts[0].style.color = "green";}

Post a Comment for "Javascript Function - Change The Color Of Text"