Reputation: 149
A couple of days ago I had a question about the use of a library called select2,
that in the official documentation for its installation and use you have to obtain the element through jquery $('.mySelect').select2();
my doubt is what it does exactly when you do this action .select2();
(in a technical way) to the element and what would be the equivalent action doing it with document.getElementById('mySelect')
.
Upvotes: 0
Views: 45
Reputation: 867
It's a jQuery-Plugin
. Underlying there is a function which has a reference to your selected element (.mySelect
) in the this
statement. Take a look here for more information https://learn.jquery.com/plugins/basic-plugin-creation/
Upvotes: 1
Reputation: 1302
Select2 is based on Jquery, can't use Select2 without Jquery.
Upvotes: 0