C
C
Castle5402015-11-01 14:11:29
JavaScript
Castle540, 2015-11-01 14:11:29

How to make the option of the select hidden (collapse) when clicking on any space of the body, and not just on the select?

Greetings!
How in this plugin: formstone.it/components/dropdown to make the select itself close the option when clicking on any space of the body, not just the select?

Sources: https://yadi.sk/d/ubeRkxpLk9tvS

PS: I'm just starting to learn javascript, but I would like to know. If select was closed in this plugin, I wouldn't ask.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Zuev, 2015-11-01
@Castle540

You can look at the source.

Formstone.$body = $("body");
$Body.on(Events.click + data.dotGuid, ":not(" + Classes.options + ")", data, closeOptionsHelper);

Delegation is used. Based on this example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question