0

What is the code for toggle button?

when you click on button it should show other button like book unbook type

12th Jun 2017, 11:43 AM
Raghu
5 Réponses
+ 7
var button = document.getElementById("button-id"); button.addEventListener("click", function(){ if (button.classList.contains("unbook")){ button.classList.remove("unbook"); } else { button.classList.add("unbook"); } }); All you need is to specify #button-id.unbook style in CSS
12th Jun 2017, 3:24 PM
SANYABEAST
SANYABEAST - avatar
+ 2
More descriptive question please.
12th Jun 2017, 11:50 AM
Calviղ
Calviղ - avatar
0
More details please.
12th Jun 2017, 12:12 PM
Anaet Hossain Rezve
Anaet Hossain Rezve - avatar
12th Jun 2017, 2:06 PM
Calviղ
Calviղ - avatar