Show div id on click with jQuery

0 votes

When a div is clicked, I want different div to appear.

Thus, when '#music' is clicked, I want '#musicinfo' to appear.

Here is the css:

#music {
    float:left;
    height:25px;
    margin-left:25px;
    margin-top:25px;
    margin-right:80px;
    font-family: "p22-underground",sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size:13pt;

    }

#musicinfo {
    width:380px;
    margin:25px;
    font-family: "p22-underground",sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size:13pt;
    line-height:1.1;
    display:none;

}

and jquery:

<script type="text/javascript">
$("#music").click(function () {
$("#musicinfo").show("slow");
});
</script>

Any help whatsoever would be great :)

Jun 20, 2022 in JQuery by gaurav
• 23,260 points
4,232 views

1 answer to this question.

0 votes

To show and hide div on mouse click using jQuery, use the toggle() method. On mouse click, the div is visible and on again clicking the div, it hides.

answered Jun 20, 2022 by rajatha
• 7,680 points

Related Questions In JQuery

0 votes
0 answers

Toggle show/hide on click with jQuery

I got a div element, so when I click ...READ MORE

Jun 10, 2022 in JQuery by gaurav
• 23,260 points
862 views
0 votes
1 answer

How to attach callback to jquery effect on dialog show?

Hello, Try out the code using jQuery Promise object: $("#dialog").dialog({ ...READ MORE

answered May 30, 2020 in JQuery by Niroj
• 82,840 points
2,246 views
0 votes
1 answer

How to trigger a click on a link using jQuery

If you are trying to trigger an ...READ MORE

answered Jun 3, 2022 in JQuery by Edureka
• 13,690 points
16,416 views
0 votes
1 answer

Show Page Loading Spinner on Ajax Call in jQuery Mobile

 Use the ajaxStart() and ajaxStop() Method While working ...READ MORE

answered Jun 10, 2022 in JQuery by gaurav
• 23,260 points
1,434 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,520 points
1,314 views
0 votes
1 answer

Error: Global Variable is not accessable to local function

Hey kartik, A variable declared outside a function has a ...READ MORE

answered Feb 19, 2020 in PHP by Niroj
• 82,840 points
1,086 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
15,709 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,295 views
0 votes
1 answer

Toggle show/hide on click with jQuery

jQuery toggle() Method The toggle() method toggles between ...READ MORE

answered Jun 13, 2022 in JQuery by rajatha
• 7,680 points
2,721 views
0 votes
1 answer

How to trigger a click on a link using jQuery

$( "#foo" ). trigger( "click" ); As of jQuery ...READ MORE

answered Jun 10, 2022 in JQuery by rajatha
• 7,680 points
725 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP