wenzhixin / multiple-select

A jQuery plugin to select multiple elements with checkboxes :)
http://multiple-select.wenzhixin.net.cn
MIT License
1.91k stars 652 forks source link

Select element is missing within multiple-select events #555

Open vivekapex opened 3 years ago

vivekapex commented 3 years ago

Select element instance is not accessible from within majority of the events. This is giving a hard time when I want to apply logic on the select element itself.

Note that when a page has only one or two select elements it's manageable but when you don't know how many such selects are gonna be in one page (in my case each report structure in my reporting engine has it's own number of selects e.g. 10, 13, 9, 5, etc), it becomes a nightmare to manage.

Any suggestions or ideas would really be appreciated. Thanks.

NicholasAntidormi commented 3 years ago

I have the same issue. I think that passing "this" as argument when an event function is called could solve the problem.

es. change this.options.onOpen() with this.options.onOpen(this) here https://github.com/wenzhixin/multiple-select/blob/7ea08b0176a84f95183d281aa96692f49fd434b4/src/MultipleSelect.js#L658