1

Possible Duplicate:
Can getElementsByClassName change style?

I am trying to "fix" the "new" YouTube using Greasemonkey, I've been getting things to work as they should when it's with ID's, however I have been unable to modify anything with a class, it appears I am unable to select it or whatever anyways.

I have been trying to use:

document.getElementsByClassName("video-extras-sparkbar-likes").style.height='10px';

However it isn't working. :\

I'm not very familiar with Greasemonkey and what not, so would there be a reason why though my browser supports this, Greasemonkey may not?

Community
  • 1
  • 1
Dylan Cross
  • 5,918
  • 22
  • 77
  • 118

1 Answers1

3

You might need to loop through the results, like this:

var divs = document.getElementsByClassName('video-extras-sparkbar-likes');
for(var i=0; i < divs.length; i++) { 
  divs[i].style.height = '10px';
}
palaѕн
  • 72,112
  • 17
  • 116
  • 136
  • I'm sure that would work and all, however it doesn't seem to be working with Greasemonkey, or at least with this particular YouTube element. – Dylan Cross Dec 09 '12 at 21:47