How to call onClose in multiple select box in jQuery Mobile

how to find out if the user closes the multiple choice window?

There is nothing in jQuery Mobile Docs.

I am looking for something like the onClose event.

I already tried setting onBlur to select, but did not work.

Thanks for any help.

+4
source share
1 answer

You can .trigger() custom events when any specific UX occurs:

 $(document).delegate('.ui-selectmenu-screen', 'click', function () { //find the select and trigger a `close` event since the overlay was clicked $(this).prev().find('select').trigger('close'); }).delegate('.ui-select', 'click', function () { //find the select and trigger an `open` event since the menu was clicked $(this).find('select').trigger('open'); }); 

I could not determine exactly how to bind to the X button (close) for the widget, but I'm sure you can trigger a custom event.

Using the code above, you can register event handlers for the open and close events for the select element:

 $(document).delegate('#select-choice-9', 'open close', function (event) { console.log(event.type); }); 

Here is a demo: http://jsfiddle.net/AaKnG/

0
source

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


All Articles