I have been scouring the internet for a solution to my issue.
Currently, I am working with materialize css chips and I am trying to achieve a specific functionality. I want the color of the last chip to turn green and the rest to turn red when a checkbox is checked. When the checkbox is unchecked, all the chips should turn red. I'm not sure if this can be accomplished given my current set of conditions.
$('.chips-placeholder').chips({
placeholder: 'Enter options',
secondaryPlaceholder: '+Options',
limit:6
});
$(document).ready(function() {
$('#anscheck').change(function() {
if($("#anscheck").is(":checked")){
}
});
});
html
<div class="row opt">
<div class="col m4 s10 offset-m3 chips-placeholder">
<input type="text" name="opts[]">
</div>
<div class="col m4 s10 switch correctans">
<label>
Off
<input type="checkbox" id='anscheck'>
<span class="lever"></span>
On
</label>
</div>
</div>