I have serval div’s with classes and I want to define them in javascript.
Here is my jsfiddle script, It’s only using DIV ID now but it has to be classes because I want to Add multiple blocks.
Can someone help?
var block = document.getElementById('block');
var minimizewindow = document.getElementById('minimizewindow');
block.style.height = "250px";
minimizewindow.style.display = "none";
//function minimize
minimize.onclick = function(){
if(block.style.height == "250px") {
block.style.display = "none";
} .........
click on the broken images for : minimize, maximze, close
Thank you!
EDIT : Think I don’t get it, I wan’t to show and hide multiple div’s…
document.getElementsByClassName('myClass');is the easiest way, however it is not supported by IE. Mozilla has great documentation on this.If you need IE support, this page might be a good resource for you: http://robertnyman.com/2008/05/27/the-ultimate-getelementsbyclassname-anno-2008/