I have an input box with class use-keyboard-input. I want to have DOM event fire in all click events except when the input box is clicked
I did:
$('*').click(function(event) {
if ($(this).hasClass('use-keyboard-input') == false){
console.log(`pressing outside the box`)
keyboardHidden = false
$('.keyboard--hidden').each(()=>{
keyboardHidden = true
})
if (keyboardHidden == false){ //If keyboard is not hidden
// if (this !== $(".keyboard")) {
Keyboard.close();
console.log(`Close the keyboard`)
// }
}
}
});
However, even when I click inside the input box with class use-keyboard-input, I get the console message
console.log("pressing outside the box")
event.stopPropagation()to prevent event bubbling up.