please help me, select2 v4+ change event not working.
this is my code :
$(document).ready(function(){
$("#asal").on("change", function(){
var asallbl = $("#asal :selected").parent().attr("label");
if(asallbl === "Singapore"){
$("#tujuan").find("optgroup[label='Indonesia']").show();
$("#tujuan").find("optgroup[label='Singapore']").hide();
$("#tujuan").prop("selectedIndex", 0);
}else{
$("#tujuan").find("optgroup[label='Indonesia']").hide();
$("#tujuan").find("optgroup[label='Singapore']").show();
$("#tujuan").prop("selectedIndex", 0);
}
});
});
Tags: exception, java, javascriptjavascript, pdo, select