jquery - How to select multiple options dynamically in chosen select -


I am selecting to choose Jquery on the HTML page where the user can choose multiple options and save the record. I need to present the update page to the user and I am trying to drop down selectively selected multi select items with archived options. The selected single selection can be done by triggering an update:

  $ ('# ns_StatusClass'). Val (2); $ ('# Ns_StatusClass') Trigger ("Chosen: Update") ;.  

But I am not able to understand how to be completed with the selected options selected. I tried to trigger the update after selecting such values:

 for  (var i = 0; i & lt; $ PAGE.allStatus.length; i ++ ) {$ ('# Ns_StatusClass') Val ($ PAGE.allStatus [i] .id); //$ ('#ns_StatusClass').trigger("chosen:updated "); } $ ('# Ns_StatusClass') Trigger ("Selected: Updated");  

But it only shows results with the last option in selecting the loop.

Is not it possible to set many options in the multiple select dropdowns?

Use this code to select several options:

 < Code> (var i = 0; i & lt; $ PAGE.allStatus.length; i ++) {$ ('# ns_StatusClass option [value =' + $ page allstatus [i] .id + ']' ). Ether ("selected", "selected"); }  

If there are one or more spaces, then use the double coat:

 for  (var i = 0; i  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -