I have several classes named .tag
on a click/mousedown action I want to either change clear:both
to clear:none
on all .tag
items. Or add the class .clearNone { clear:none; }
to all the tags.
What I've tried so 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 does 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 would you accomplish this? Note there are hundreds of .tag
's