Commit 994655cd authored by Tim Rogers's avatar Tim Rogers

MGU-746 only set toggle if there is a limit set

parent fd14a13e
...@@ -49,17 +49,19 @@ module.exports={ ...@@ -49,17 +49,19 @@ module.exports={
autocompleteData: availableTags.autocomplete, autocompleteData: availableTags.autocomplete,
onlyAutocomplete: true, onlyAutocomplete: true,
}); });
const $input = $el.find('input'); if($.widget.limit) {
const toggleInput = function() { const $input = $el.find('input');
if($.widget.limit && $el.find('.chip').length >= parseInt($.widget.limit)) { const toggleInput = function() {
$input.attr('disabled', true); if($el.find('.chip').length >= parseInt($.widget.limit)) {
} else { $input.attr('disabled', true);
$input.attr('disabled', false); } else {
$input.attr('disabled', false);
}
} }
toggleInput();
chips.on('chip.add', toggleInput)
chips.on('chip.delete', toggleInput)
} }
toggleInput();
chips.on('chip.add', toggleInput)
chips.on('chip.delete', toggleInput)
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment