Reputation: 4081
I want to add checkbox element to a combo box / select element dynamically. I tried with this
var option="";
for (i = 0; i <= 5; i++) {
option = option + '<option><input type="checkbox" name="myCheckbox" value="checkbox" /></option>';
}
$('#cmbRebateCategories1').append(option);
This is the HTML markup I have,
<select id="cmbRebateCategories1">
</select>
but its not working. Please help me out.
Upvotes: 0
Views: 736
Reputation: 129792
This is not something that the <option>
element supports. You'd have to roll your own select replacement.
jQuery UI MultiSelect Widget appears to be doing what you're requesting.
Upvotes: 2