How to Select All element of SELECT2

Select2 is very famous jquery plugin for HTML Select control. Select2 also supports multi-value select boxes. Select2 is very easy to use and configurable.

Select2 provides you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly used options.

Also checkout other tutorials of select2,

How To Apply Select2 On HTML Select Element

as u can see, I have used select2() method on HTML dropdown which id is #selectId.

No i will tell you how to select all elements of multi select box onClick() of particular option, ie. if you have option ‘all’ in multi select box and you need to select all element of multi select when the user select 'All' option.

Select All Options of select Box Using Select2

The following code need to use select all options of multi select box,