JQuery Chosen Multi Select Dropdown Example
Hi Friends,
In this quick example, let's see jquery chosen set multiple selected value. This article will give you a simple example of jquery chosen set selected value. We will use jquery chosen get selected value. I explained simply step by step jquery chosen plugin set selected value. you will do the following things for jquery chosen set dropdown selected value.
If you require to set selected value in Chosen Jquery Plugin then you can done using val() with trigger(). Some days ago, i had worked my php project i needed to set selected value wiht chosen and also multiple selected value both. After some try i found how to do with if set single selected value using val().
But i was confuse with dropdown multiple selected value, but at last i found how to give value, we have to just pass array in val(). As bellow i mention both way how could done.
Set Single Value:
var my_val = 3;
$("#set-corsi").val(my_val).trigger("chosen:updated");
Set Multiple Value:
var my_val = 3,4,6;
var str_array = my_val.split(',');
$("#set-corsi").val(str_array).trigger("chosen:updated");
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Remove Last Element from Array in JQuery?
- How to Print Iframe Content using Jquery?
- Jquery Input Mask Phone Number Validation Example
- How to Set Radio Button Checked Based on Value using JQuery?
- JQuery Open Link in New Window Example
- How to Check If Key Exists in JSON Object using JQuery?
- PHP MySQL Create Dynamic Treeview Example
- PHP JQuery Chosen Ajax Autocomplete Example
- Codeigniter JQuery Ajax Request Example
- How to Copy Text to Clipboard without Flash using JQuery?
- JQuery Hide and Show Password using Eye Icon Example
- How to Remove Specific Value from Array in JQuery?