purencool — 2011-10-16T21:59:12-04:00 — #1
I have fives div with a class tag when a page loads that is display:none; At some point I want
the divs to display and to keep it semantically correct I have used classes. But I can't seem
to get them to display when a link is clicked. Below is where I have got to any help would be great.
var displayMyclass = document.getElementsByTagName("myclass");
displayMyclass.style.display = "block";
ralphm — 2011-10-17T00:13:04-04:00 — #2
"myclass" isn't a tag name, but a class name. getElementByClassName isn't supported in all browsers, though, so you may need something more elaborate.
alex69 — 2011-10-18T08:51:58-04:00 — #3
Try to display elements using jquery.
Something like var elements = $(".myclass");
And then use "elements" variable like an array of your elements, which have a necessary class.
felgall — 2011-10-18T14:45:44-04:00 — #4
JQuery is overkill if all you are after is a class name lookup.