[Solved] JavaScript hasClass or is not working


Your code does not use the hasClass method.

Change it to

$(modalSearch).hasClass('border-is-danger')

If you want to use .is(), use a class selector, not a tag selector

$(modalSearch).is('.border-is-danger')

solved JavaScript hasClass or is not working