classname - javascript to change all class values in a div -
is there way change class value of buttons js? right i've got:
var nodes = document.getelementsbyclassname("yui-button yui-radio-button");
and loop
(i=0;i<nodes.length;i++) { nodes[i].classname = "something"; }
is there anyway bypass loop , change class values?
here's html:
<div id="season" align="center"> <div id="seasonbuttons" class="yui-buttongroup"> <span id="yui-gen0" class="yui-button yui-radio-button"> <span class="first-child"> <button type="button" id="yui-gen0-button">spring</button> </span> </span> <span id="yui-gen1" class="yui-button yui-radio-button"> <span class="first-child"> <button type="button" id="yui-gen1-button">summer</button> </span> </span> <span id="yui-gen2" class="yui-button yui-radio-button"> <span class="first-child"> <button type="button" id="yui-gen2-button">fall</button> </span> </span> </div> </div>
you can jquery
$(".yui-button,.yui-radio-button").addclass("something").removeclass("yui-button yui-radio-button");
Comments
Post a Comment