Answers for "select 2 multiple"

3

html select multiple

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.jquery.min.js"></script>
<link href="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.min.css" rel="stylesheet"/>

<form action="http://httpbin.org/post" method="post">
  <select data-placeholder="Begin typing a name to filter..." multiple class="chosen-select" name="test">
    <option value=""></option>
    <option>American Black Bear</option>
    <option>Asiatic Black Bear</option>
    <option>Brown Bear</option>
    <option>Giant Panda</option>
    <option>Sloth Bear</option>
    <option>Sun Bear</option>
    <option>Polar Bear</option>
    <option>Spectacled Bear</option>
  </select>
  <input type="submit">
</form>
Posted by: Guest on March-25-2021
-1

Select 2

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
Posted by: Guest on February-19-2021
0

select 2 multiselect

//Installation
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>



// In your Javascript (external .js resource or <script> tag)
$(document).ready(function() {
    $('.js-example-basic-single').select2();
});
Posted by: Guest on October-20-2020
0

html select multiple

$(".chosen-select").chosen({
  no_results_text: "Oops, nothing found!"
})
Posted by: Guest on March-25-2021
-1

select2 multiple selected values

in_array($value, $array)
Posted by: Guest on March-22-2021
-2

select 2 select a value

SELECT2 V4 :
============
For select2 v4 you can append directly an option/s as follow:

<select id="myMultipleSelect2" multiple="" name="myMultipleSelect2[]">
    <option value="TheID" selected="selected">The text</option>                                                                   
</select>

Or with JQuery:
---------------

var $newOption = $("<option selected='selected'></option>").val("TheID")
					.text("The text")
 
$("#myMultipleSelect2").append($newOption).trigger('change');

other example :
---------------

$("#myMultipleSelect2").val(5).trigger('change');
Posted by: Guest on December-23-2020

Browse Popular Code Answers by Language