Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 09-26-2015, 11:12 AM   #1
Solid State Member
Join Date: Sep 2015
Location: america
Posts: 9
Default Help me with this function

Im trying to get a display: none style to change from none to block on multiple divs using a single function. It only works on the first div. How can I get this to work?

function show(name) {
var e = document.getElementsByClassName(name);
if(e.style.display == 'none')
e.style.display = 'block';
e.style.display = 'none';


<p onclick="show('li')">Click here</p>

<ul class='li'>

<ul class='li'>
d9esco is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 03:55 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0