1

How to implement multi checkbox drop down without any third party libraries.

We want a dropdown having checkboxes not in jquery and javascript. we want pure server side control .

  • 3
    Unless you provide what you tried so far and are stuck with a specific problem, the site is not designed to code for you. In this case, you should look for online courses, tutorials or hire professional coding services. See also [how to ask](https://stackoverflow.com/help/how-to-ask) – Lex Lustor Feb 14 '18 at 08:13

1 Answers1

0

Pure server side control means you will only rely on the HTML standards.
The HTML Select element has a multiple attribute which lets the user choose multiple values.
The HTML specification doesn't require a specific rendering layout which lets the browser free from any constraints. Most of the time, selected options are simply hightlighted, plus the multiple attribute makes the select element to loose its dropdown looking style (you can reduce its height using the size attribute).

<!-- The second value will be selected initially -->
<p>Maintain <kbd>Ctrl</kbd> key down to select multiple elements</p>
<select name="multi" multiple size="2">
  <option value="value1">Value 1</option> 
  <option value="value2" selected>Value 2</option>
  <option value="value3">Value 3</option>
  <option value="value4">Value 4</option>
  <option value="value5">Value 5</option>
  <option value="value6">Value 6</option>
  <option value="value7">Value 7</option>
  <option value="value8">Value 8</option>
  <option value="value9">Value 9</option>
  <option value="value10">Value 10</option>
</select>

If you change your mind about using Javascript, you could implement what this well detailed answer suggests as it requires just very few additional Javascript and css and but no library.

Stphane
  • 3,368
  • 5
  • 32
  • 47