javascript - Replace all the text in a div with class name - only js -
i'm trying text in div class name:
<div class="something...">
and replace text something. no, don't want use jquery.
should straight forward
var elements = document.queryselectorall('.something'); ( var i=elements.length; i--; ) { elements[i].textcontent = "something else"; }
<div class="something">soft</div> <br> <div class="something">kitty</div> <br> <div class="something">warm</div> <br> <div class="something">kitty</div> <br> <span class="something" style="color:green">little ball of fur ...</span>
Comments
Post a Comment