Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

addClass to an element with that class already? [closed]

Tags:

jquery

If I were to call addClass on an element that already had the class I was adding, such as:

<div id="lolID" class="lolClass"></div>

and then:

$("#lolID").addClass("lolClass");

Would this cause problems or just do nothing?

Same for removeClass but reversed.

like image 830
Cristiano Avatar asked May 31 '13 19:05

Cristiano


1 Answers

Nope. No effect. jQuery handles that for you.

like image 191
landons Avatar answered Oct 17 '22 18:10

landons