Answers for "set value of select2 jquery"

2

jquery select2 set value

<select id="lang" >
   <option value="1">php</option>
   <option value="2">asp</option>
   <option value="3">java</option>
</select>

<script>
	$("#lang").select2().select2('val','1');
</script>
Posted by: Guest on May-10-2021
0

jquery to set value in select2 dropdown button

$("#u20_cre").select2().val(["1","6"]).trigger("change");
Posted by: Guest on January-09-2021
0

jquery select2 multiple select all

$("#checkbox").click(function(){
    if($("#checkbox").is(':checked') ){
        $("select > option").prop("selected","selected");
    }else{
        $("select > option").removeAttr("selected");
     }
});
Posted by: Guest on September-15-2020

Code answers related to "set value of select2 jquery"

Browse Popular Code Answers by Language