I'm using selectize.js something like this:
$( 'select' ).selectize( {
onChange: function( value ) {
// how to get original element here?
}
} );
There's several select elements on the page.
I want to get select on which the event occurred inside of onChange.
How can I do it?
you can use $(this)[0] inside the onChange. Once this is the selectize object by itself
$( 'select' ).selectize( {
onChange: function( value ) {
var obj = $(this)[0];
alert(obj.$input["0"].id);
}
} );
Here's a Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With