2016-11-05 45 views

回答

1

應該是直截了當

var elements = document.querySelectorAll('.something'); 
 

 
for (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>

相關問題