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')
.
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/
Select2 is based on Jquery, can't use Select2 without Jquery.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.