abdul abdul - 8 months ago 30
HTML Question

How to show a div when a particular button is clicked,

This my js code:

  • i want to click first button to call a new class,it works but, every
    button doing same work. when i click second button this also calling
    a new class.please help me to solve this.

    $("button").click(function(){ /*button click event*/
    $(".new").toggle(); /*new class calling */

    this my html code:


    <div class="new" style = "display: none;">hi.</div> <!--i need to call only this class-->
    <div class="old"><a href="www.google.com">hello.</a></div>


give id's to the buttons, n call those accordingly like