Populate the selectbox dynamically using chosen.js - jquery -
i can change placeholder after page has loaded (shown below),
$('#dropdown1').chosen(); $('#dropdown1').attr('data-placeholder', 'pizza , chips'); $('#dropdown1').trigger('chosen:updated');
but cant seem add values taken database. want them bee added straight text box, have been selected. should square , grey , can deselected if wished....???
the answer simple, took me while, thinking had via jquery when was adding 1 word "selected" in option!
<select class="html-multi-chosen-select" multiple="multiple"> <option value="foo" selected>foo</option> <option value="bar" selected>bar</option> <option value="dog">dog</option> <option value="cat">cat</option> </select>
fiddle here http://jsfiddle.net/mikeys4u/99dkm/235/
Comments
Post a Comment