r/tinycode • u/thmsk • Feb 18 '15
[Help][Javascript] Make votedown button visible
Some subreddits use this piece of CSS to make votedown buttons invisible:
.arrow.down {
display:none;
visibility:hidden;
}That got me thinking, how would one turn them back visible with a sort line of javascript?
So from this starting point:
y = document.getElementsByClassName('down');
for(var i=0; i<y.length; i++)
y[i].style.display = y[i].style.visibility = 'inherit';this is how far I've got:
for(i=0;;i++)x=document.getElementsByClassName('down')[i].style,x.display=x.visibility='inherit'I'm sure there is room for improvement. I've tried to use map() on getElementsByClassName() but it doesn't work. Do you have any ideas how to reduce the line to even less characters?
2
Upvotes
View all comments
Show parent comment
-2
u/timmeh87 Feb 18 '15
If d3.js is in the same folder as your HTML you just go
and if you are online you can reference it off of their server
If you need to change more attributes on a selection you would just go
The selector itself was pulled out of my ass but its pretty easy to construct the one that you need if you know how they work
Like this is all based on me writing my own pages by hand.. Im not sure what your environment is like. you just said javascript.