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?
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?
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.
Using jquery it is very simple.
$("#buttonID").on('click',function(){
$("listID").toggleClass("contentVisibulity");
});
css
.contentVisibulity{
display:none;
}