Open Tadek888 opened 8 years ago
Ok. I found comment that this is impossible because this is multi-select plug-in so I wrote something like this. Its not perfect but it works... Maybe someone can improve it. ` <select id="sell-options" multiple="multiple" name="sell_opt"> <option value="a_sell">sell opt 1</option> <option value="b_sell">sell opt 2</option> <option value="c_sell">sell opt 3</option> <option value="d_sell">sell opt 4</option> <option value="e_sell">sell opt 5</option> <option value="f_sell">sell opt 6</option> </select> <script> $('#sell-options').multiSelect(); $('div#ms-sell-options').each(function(){ $('div#ms-sell-options div.ms-selectable li:nth-child(1)').addClass('a-sell'); $('div#ms-sell-options div.ms-selectable li:nth-child(2)').addClass('b-sell'); $('div#ms-sell-options div.ms-selectable li:nth-child(3)').addClass('c-sell'); $('div#ms-sell-options div.ms-selectable li:nth-child(4)').addClass('d-sell'); $('div#ms-sell-options div.ms-selectable li:nth-child(5)').addClass('e-sell'); $('div#ms-sell-options div.ms-selectable li:nth-child(6)').addClass('f-sell'); });
$('li.a-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['b_sell', 'c_sell', 'd_sell', 'e_sell','f_sell']); $('#sell-options').multiSelect('select', ['a_sell']); return false; });
$('li.b-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['a_sell', 'c_sell', 'd_sell', 'e_sell','f_sell']); $('#sell-options').multiSelect('select', ['b_sell']); return false; });
$('li.c-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['a_sell', 'b_sell', 'd_sell', 'e_sell','f_sell']); $('#sell-options').multiSelect('select', ['c_sell']); return false; });
$('li.d-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['a_sell', 'b_sell', 'c_sell', 'e_sell','f_sell']); $('#sell-options').multiSelect('select', ['d_sell']); return false; });
$('li.e-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['a_sell', 'b_sell', 'c_sell', 'd_sell','f_sell']); $('#sell-options').multiSelect('select', ['e_sell']); return false; });
$('li.f-sell').click(function(){ $('#sell-options').multiSelect('deselect', ['a_sell', 'b_sell', 'c_sell', 'd_sell','e_sell']); $('#sell-options').multiSelect('select', ['f_sell']); return false; }); </script> `
Hey is there any possibility to select only one option? On select other previous will be deselected.