css - Pure JavaScript - how to add class to a class? Or change style in class -


i have several classes named .tag on click/mousedown action want either change clear:both clear:none on .tag items. or add class .clearnone { clear:none; } tags.

what i've tried far without luck:

function mousedown(e) {     window.addeventlistener('mousemove', sizepanel, true);      // using id works     var tagscol = document.getelementbyid("tags-col");     tagscol.classlist.add("width100");      // using class not     var tag = document.getelementsbyclassname("tag");     tag.classlist.add("clearnone"); }; 

css

.tag {     overflow: hidden;     float: left;     position: relative;     margin: 0 10px 10px 0;     padding: 5px 10px;     width: auto;     cursor: pointer;     clear: both;     @include rounded(4px); }  .clearnone  { clear: none; } 

how accomplish this? note there hundreds of .tag's

don't that.

instead, add marker classname common ancestor element, use css rule:

.someclassname .tag {     clear: both; } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -