Add and Remove class to click a dynamic Button
Trying to Add and Remove class to click dynamic Buttons, means this button <button class="one"></button> get class dynamically like this: <button class="one text1">text1</button> So if button one has class .text1 and by click this add class .hide to list item <li class="text1"> like <li class="text1 show"> Same for button two <button class="two"></button> and by click add class <li class="text2 show"> Note: when click button two , then should remove class .show and add new class .hide to button one . Main HTML: <div id="main-id"> <button class="one"></button> <button class="two"></button> <ul>