[JS] Check select2 jquery plugin loaded or not

Read How to async defer CSS JS perfectly
if (jQuery.fn.select2) { //jquery select2 loaded or not false or not undefined => return array
  jQuery.fn.select2.defaults.set( "theme", "bootstrap" ); //then select themes

Example: How to change select2 jQuery plugin using jQuery.val()

  $('#mySelect2').val('US'); // Change the value or make some change to the internal state
if (jQuery.fn.select2) {
  $('#mySelect2').trigger('change.select2'); // Notify only Select2 of changes

0 Response to "[JS] Check select2 jquery plugin loaded or not"

Post a Comment

Bila Ada posting yang kurang, atau error atau yang lainnya, silahkan tinggalkan komentar agar artikel/post di perbaiki.
Jangan Lupa Cek Box "Notify Me" agar tahu komentar kamu dibalas oleh saya.

If there are any posts that are missing, or error or anything else, please leave a comment for the article / post to be fixed.
Do not Forget Check Box "Notify Me" to know our comments replied by me.

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel