0

Is there any way to get hasClass() to look for any of multiple classes? I see people doing things like

if( ($(e.target).hasClass('box')) ||
    ($(e.target).hasClass('imgBox'))  ){

which would be much cleaner with something like

if( ($(e.target).hasClass('box imgBox')

Thanks

Steve
  • 4,534
  • 9
  • 52
  • 110

1 Answers1

2

Try

if( ($(e.target).is('.box, .imgBox')
Musa
  • 96,336
  • 17
  • 118
  • 137