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={
autocompleteData: availableTags.autocomplete,
onlyAutocomplete: true,
});
const $input = $el.find('input');
const toggleInput = function() {
if($.widget.limit && $el.find('.chip').length >= parseInt($.widget.limit)) {
$input.attr('disabled', true);
} else {
$input.attr('disabled', false);
if($.widget.limit) {
const $input = $el.find('input');
const toggleInput = function() {
if($el.find('.chip').length >= parseInt($.widget.limit)) {
$input.attr('disabled', true);
} 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