prakashchhetri
prakashchhetri

Reputation: 1816

show/hide div when same link is clicked

I have a link that when clicked displays a <div> which contains a <form>. I would like to hide the <div> containing <form> when the link is clicked again and display it again when clicked. I have created a simple Jquery to hide the div. How can I implement it to show/hide when same link is clicked.

$("#customize").click(function(){
    $("#cust").hide('slow');
    return false;
});

Upvotes: 1

Views: 968

Answers (1)

adeneo
adeneo

Reputation: 318372

To toggle visibilty, use toggle() :

$("#customize").click(function(){
    $("#cust").toggle('slow');
    return false;
});

Upvotes: 7

Related Questions