How to make two buttons and trigger two divs show and hide respectively using js? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make two buttons and trigger two divs show and hide respectively using js?

When button 1 is clicked only div1 is shown and vice versa.

18th Dec 2019, 3:08 AM
Niranjan Shrestha
Niranjan Shrestha - avatar
3 Answers
+ 6
//Use jquery button div (display:none) $("button").on('click', ()=>{ $('div').toogle() } )
18th Dec 2019, 6:19 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Umm it should be easy, where is your attempt ?
18th Dec 2019, 3:22 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Shudarshan Rai 👑 this will toggle in on button and div.
23rd Dec 2019, 2:19 AM
Niranjan Shrestha
Niranjan Shrestha - avatar