I have implemented a Pillbox via FuelUX into one of my pages. We are using the pillbox to help give a better visual to our filtering system. A user will check a checkbox and then a pill will append. The issue is that after pressing "x" on the pill and closing it, we would like for the checkbox to uncheck as well.
<div class="fuelux">
<div class="pillbox col-sm-4 well well-lg" data-initialize="pillbox" id="myPillbox" style="min-height: 200px;">
<p class="text-center"><u><b>SELECTED FILTER OPTIONS</b></u></p>
<ul class="clearfix pill-group">
</ul>
</div>
</div>
Here is the jquery
function addPillBox(obj) {
var response = $('label[for="' + obj.id + '"]').html();
if (document.getElementById(obj.id).checked) {
$('#myPillbox').pillbox("addItems", [{ text: response, value: '', attr: {}, data: {} }]);
} else {
$('#myPillbox').pillbox('removeByText', response);
}
}
$('#myPillbox').click('removed.fu.pillbox', function (evt, obj) {
alert('hit');
$("#" + obj.id).attr('checked', false); // Unchecks it});
Aucun commentaire:
Enregistrer un commentaire