Browsing archives for February, 2016

jQuery: toggleClass instead of addClass

jQuery 4 February 2016 | 5,464 Comments

Sometimes you need to add a class in a div, if you click on the button on the first time. For the second time you want to remove the added class. Normally you would check, if there is already the disered class in a if condition and use addClass() or removeClass(), like that: But there [...]