JQuery event to close a closing tag

I can connect to the event of a change in the selection penalty (which will lead to the closure of the selection), which is not a problem. But I also need to detect when the select tag is closed by clicking on the screen elsewhere.

So far, everything I tried has not worked; body click, body focus, blur selection, focus selection among several combinations.

With most of them, it will be registered only in the second click on the body, therefore: Click1) The selection is closed, the event does not fire. Click2) The event is triggered.

I know that I can create my own version of the select tag (And I did it before), but it seems to be too complicated for this situation, when the normal choice is in order, I just need this one event.

Cheer, Psy

+3
source share
1 answer

Sounds like blur thang ...

$('select').on('change', function() {
    //change things here 
}).on('blur', function() {
    //when select is no longer in focus here
});

Made a violin

0
source

Source: https://habr.com/ru/post/1759287/


All Articles