I want to set the multiple ITEMS
in jQuery multiselect dropdown
depending on the VALUE
of that item, which I'm getting from database, separated by ",
".
I'm saving this fetched data in hidden field
.
Ex.
Hidden field: hdnLots = 64,65
, Items for lot No.: 64 = Lot 1, 65 = Lot2
So when I get the hdnLot=65
, then in jQuery Multiselect dropdown
only Lot2
needed to be selected. And same for 64,65. i.e. When multiple values are selected than all those values needed to seleted.
I've tried: JQuery multiselect - Set a value as selected in the multiselect dropdown
Code I've wrote for this is:
if ($("#<%= btnUpdateProject.ClientId %>").css('display') == "inline-block")
{
debugger;
var dataarray = document.getElementById('<%= hdnLots.ClientId %>').value.split(",");
$("#<%= ddlNoOfLots.clientid %>").val(dataarray);
}
$("#<%= ddlNoOfLots.clientid %>").multiselect("refresh");
– Correlatesize(height,width)
of multiselect and neither its working. – AcidfastUncaught type error: Object [object object] has no method refresh
. – Acidfastdataarray
var – Makeweightdataarray
. i.e.dataarray = 65
only, even ifhdnLots=64,65
. – AcidfastUncaught Error: Cannot call methods on multiselect prior to initialization, attempt to call method 'refresh'
in console. – Acidfast