M
M
mrWan2017-09-01 23:13:01
C++ / C#
mrWan, 2017-09-01 23:13:01

What jquery event closes select?

my plugin most likely turns the select into a list that only opens and closes when the button is clicked. What event can be applied so that this select can be closed when clicking anywhere except select-a?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
Foggy Finder, 2019-05-13
@ramzes1617

In such cases, the first thing to do is to check if the event is subscribed.
In the Visual Studio IDE, you can make sure in the designer (RMB on the element -> "Properties", then the "Events" tab) and look for the required one in the list. You can also subscribe there.
Or add the subscription yourself in the constructor:

button1.Click += button1_Click;
button2.Click += button2_Click;

M
mrWan, 2017-09-02
@mrWan

yes, as toggle
I don’t know jquery so much to do something that you said,
if it’s not difficult for you, you can sketch it ...

A
Andrey Kvartsov, 2017-09-03
@kolesov_prod

$(document).mouseup(function (e) {
    var select= $("#mySelect");
    if (!select.is(e.target) && select.has(e.target).length === 0) {
        // тут действие для закрытия селекта
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question