How to set multiple selected value in Chosen Jquery Plugin?

Today now in this post i will show you How to set multiple selected value in Chosen Jquery Plugin? Sometimes we need to set selected value in the Chosen Jquery Plugin then we can solve this by using val() with trigger(). Few days ago, i was worked with my new laravel project i was needed to set selected the value with the chosen and also multiple selected value both. I was try and then after some try i was found how to do with if set single selected value by using val().

But i was confuse with the dropdown multiple selected value, but at the last i was found how to give the value, we just need to pass array in val() just. Now as bellow i will mention both way how we could solve this issue.

Set Single Value:
var my_val = 3;
Set Multiple Value:
var my_val = 3,4,6;
var str_array = my_val.split(',');

Read Also : How to Create Custom Blade Directive in Laravel?

Thanks for read. I hope it help you. For more you can follow us on facebook.


About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →