In the button click, display one unit: none, second: display: inline-block; How do you do it?



  • There are two btn1 and btn2 buttons and there are two blocks: block1 (signal display: block;) and block2 (signal display: none;) I want to link them to this combination: In the case of btn1 button, the first block is displayed: none; and the second unit: display: inline-block; in btn2 click: first display:block; second display: none; Not strong in jquery, help counsel or example. Thank you.



  • $('.btn1').on('click', function(){
         $('.block1').css('display','none');
         $('.block2').css('display','inline-block');
    });
    $('.btn2').on('click', function(){
         $('.block1').css('display','block');
         $('.block2').css('display','none');
    });
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2