I\'m working on changing some elements the slider on my website
my slider code looks like this:
Some heading&
Edit: this is wrong as it doesn't take into account that two class names are given.
I would suggest using JQuery for something like this, which will make it easier when you try to do something more complex. However the actual problem here is that getElementsByClassName
returns an HTMLCollection
of elements, and setting innerHTML
on it doesn't set it on its elements. The following code should work:
var elements = document.getElementsByClassName('cl1 sl_price');
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = "from only £00.00
";
}