Select all values from list box in a single click using javascript

     The following example code will help you to select all or deselect all the items from list box using javascript code.


    function listboxSelectDeselect(listID, isSelect) {

      var listbox = document.getElementById(listID);

      for (var count = 0; count < listbox.options.length; count++) {

        listbox.options[count].selected = isSelect;

      }

    }



Example Program:- (Editor)


Editor is Loading...

Advertisement

Related Posts:

  • toExponential() in javascript     The toExponential() method returns a string representing the Number object in exponential notation.ParametersfractionDigits  … Read More
  • Math.floor() in javascript     The Math.floor() function returns the largest integer less than or equal to a given number. floor() is a static method of Mat… Read More
  • Math.max() in javascript     The Math.max() function returns the largest of zero or more numbers. max() is a static method of Math, you always use it as Math.m… Read More
  • Math.min() in javascript     The Math.min() function returns the smallest of zero or more numbers. min() is a static method of Math, you always use it as Math.… Read More
  • Math.random() in javascript     The Math.random() function returns a floating-point, pseudo-random number in the range [0, 1] that is, from 0 (inclusive) up to bu… Read More

0 nhận xét:

Đăng nhận xét