JSFiddle - React, Tailwind, and code Playground
by Rakesh Shetty
HTML
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<input type="checkbox" name="conditions" value="Sample1">Sample 1
<input type="checkbox" name="conditions" value="Sample2">Sample 2
<br>
<input type="checkbox" name="conditions" value="Sample3">Sample 3
<input type="checkbox" name="conditions" value="Sample4">Sample 4
<select name="Control"></select>
JavaScript
jQuery(function ($) {
var $conds = $('input[name="conditions"]'),
$ctrl = $('select[name="Control"]');
$conds.change(function () {
if (this.checked) {
$('<option />', {
value: this.value,
text: this.nextSibling.nodeValue
}).appendTo($ctrl)
} else {
$ctrl.find('option[value="' + this.value + '"]').remove();
}
})
})