Use bootstrap to realize multiple selection of select box

  1. To use bootstrap to implement multiple selections in the drop-down box, you first need to introduce js and css.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>   

Of course, you can also download js and css static resources yourself.

   2. Use of multi-select boxes on the page.

<select name="param4" id="param4" multiple="multiple" class="selectpicker form-control" style="width:180px;height: 38px;" tabindex="-98"><option value="男">男</option><option value="女">女</option></select>

The effect is as follows:

3. Pass value of multiple selection box form.

If you don't do any processing, the form can only submit one value selected by the checkbox, which will cause problems.

However, the value obtained by $("#param4").val() is indeed correct.

Therefore, at this time, simple processing should be done.

$("# param4").change(function(){

            $("input[name= param4]").val($("#param4").val())

})

        In this case, the form values ​​can be submitted correctly.

Guess you like

Origin blog.csdn.net/H517604180/article/details/94412076