JSFiddle - React, Tailwind, and code Playground
by brandrally
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<div id="item-100">
This should not be styled
<label><input name="otheritem" type="checkbox" value="100" > Test</label>
</style>
<div id="thechecks">
<div id="item-1">
<label><input name="element[]" type="checkbox" value="1" > One</label>
</div>
<div id="item-2">
<label><input name="element[]" type="checkbox" value="2" > Two </label>
</div>
</div>
CSS
.item-select {
background: #f742a0;
display:block;
}
JavaScript
$(document).ready(function () {
$("#thechecks input[type='checkbox']").click(function () {
var req = $(this).val();
$("#item-" + req).addClass("item-select");
});
});