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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -