-5

Is it any native function in jQuery which check for class in an element, and then add it if this class does not exist yet?

KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133
Jaikrexe
  • 13
  • 8

1 Answers1

1

Just call addClass(). jQuery will do the check for you. If you check on your own, you are doubling the work, since jQuery will still run the check for you.

source: Check if class already assigned before adding

Wolkowsky
  • 68
  • 1
  • 6