How do i get native select element from input field in new Release?
In 4.0.6 it worked with $(Elmnt).closest(".select2").data(“element”)[0]; Now with 4.0.11 this is not working anymore.
thx
How do i get native select element from input field in new Release?
In 4.0.6 it worked with $(Elmnt).closest(".select2").data(“element”)[0]; Now with 4.0.11 this is not working anymore.
thx
Your code would not work in the general case (and this has been true since the very first v4.0.x releases—it’s not new in 4.0.11). It would work if you use the “dropdownParent” configuration option to ensure the Select2 widget’s DOM structure is attached to the same container element as its underlying native <select>
. But unless you set the dropdownParent
option this way, the widget’s DOM structure is appended to the end of the <body>
, so the <input>
element in the Select2 widget has no particular descendant relationship to the native <select>
.