Keypress for distinct selects

Hello!

I have 4 different selects on my page (insID, MapID, CharID and LookID) and i got the

“var inInsID = $(’.select2-search__field’)[0].value;”

Workin to return my current search fild input… but it gets the same for every select, i want to differentiate by select name or id… is it possible?

What i’m lookin to do is to run keypress query AND option choose query using Ajax.

As far as I know, when you have multiple Select2’s on a page, there is only one set of DOM elements that is used to display them all. The same DOM elements are reused for each Select2 since (usually) you only have one Select2 open at a time.

I think one way you could try to work around this is to use the dropdownParent configuration option to assign a different parent element to each Select2. I’m not sure if this will actually create separate collections of DOM elements for each Select2 (i.e., a different input.select2-search__field), but I think it’s worth trying.