jquery clear select 2
$('select2element').val(null).trigger("change")
jquery clear select 2
$('select2element').val(null).trigger("change")
how to clear all the dropdown elements in jquery
$("#GroupName").empty();
clear select dropdown js
var courses = document.getElementById("special_selection");
// clear select
var length = courses.options.length;
for (i = length - 1; i >= 0; i--) {
courses.options[i] = null;
}
for (var i = 0; i < data.length; i++) {
var option = document.createElement("OPTION"),
txt = document.createTextNode(data[i].coursetitle);
option.appendChild(txt);
option.setAttribute("value", data[i].KF);
courses.insertBefore(option, courses.lastChild);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us