Help needed for my very simple script (or so I assumed)
Sorry to bother you with such a trivial issue, fact is, I'm not really into JS, don't use it often, and now I'm really stuck trying to make work a rather simple script... can someone help me please ?
I want to locate a span by its class name, then get to the div (no id, no class) inside of it, and change the div contents, and I have been ridiculously failing at it for hours now.
Here is the HTML part :
And my useless script... :
<span class="myClass"><--! Some commented text --><div>many HTML tags and text in here</div>other content I don't want to change</span>
var parents = document.getElementsByClassName('myClass'); // length return 3
var span = parents.firstChild;
var div = span.getElementsByTagName('div'); // should return only 1
var divToUpdate = div.firstChild;
Can someone see where the problem is ?