I am using this code.
"use strict";
// Class definition
let KTSearch = function () {
// Private variables
let form;
// Init Select2
const initSelectXYZ = () => {
// Init Select2 --- more info: https://select2.org/
$("[name="provincia_id"]").select2();
}
// Public methods
return {
init: function () {
form = document.getElementById("kt_search_form");
initSelectXYZ();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
KTSearch.init();
});
Uncaught TypeError: $(...).select2 is not a function
Hi,
Sorry for the delay, and we miss looked into this issue. Could you please try to add the below code on top of this file?
require("select2");
Try adding the select2 script to your application.
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>