-1

I'm trying to make a button which when clicked, makes a list appear/disappear.

How would I go about linking the two?

Would Javascript be the best option for this, or can this be achieved with CSS?

anothermh
  • 9,815
  • 3
  • 33
  • 52
Celestriel
  • 377
  • 1
  • 5
  • 12

3 Answers3

0

from what i understand, maka div with all the contents that you need to show on click. then write on click function for the button and use show() or toggle function to show the div.

$( "#buttonid" ).click(function() {
$('#divtoshow').show();
});

instead of show() you can use toggle() also.

Anju Aravind
  • 3,262
  • 2
  • 16
  • 22
0

jQuery will help you here.

You can use the click event along with show to achieve this

Nikhil Talreja
  • 2,754
  • 1
  • 14
  • 20
0

Using jquery it is very simple.

$("#buttonID").on('click',function(){
$("listID").toggleClass("contentVisibulity");

});

css

.contentVisibulity{
display:none;
}

Jquery Doc

chandu
  • 2,276
  • 3
  • 20
  • 35