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,034
  • 8
  • 46
  • 99

1 Answers1

2

Try

if( ($(e.target).is('.box, .imgBox')
Musa
  • 93,746
  • 17
  • 112
  • 129