abdul abdul - 1 year ago 69
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>

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download