Answers for "clear select dropdown jquery"

1

jquery clear select 2

$('select2element').val(null).trigger("change")
Posted by: Guest on April-12-2021
-1

how to clear all the dropdown elements in jquery

$("#GroupName").empty();
Posted by: Guest on May-07-2020
0

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);

    }
Posted by: Guest on June-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language