WM-12: hide other value row when not checked

This commit is contained in:
Oliver Zander 2025-11-10 11:15:42 +01:00 committed by Tobias Herre
parent 714d249608
commit 638f6cd5ed
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@
const otherInput = $(otherInputSelector); const otherInput = $(otherInputSelector);
const otherLabelSelector = 'label'.concat('[for="', this.id, '_other"]'); const otherLabelSelector = 'label'.concat('[for="', this.id, '_other"]');
const otherLabel = $(otherLabelSelector); const otherLabel = $(otherLabelSelector);
const otherTableRow = otherInput.parents('tr');
const toggle = function () { const toggle = function () {
const checked = otherCheckbox.prop('checked'); const checked = otherCheckbox.prop('checked');
@ -13,7 +14,7 @@
otherInput.prop('disabled', !checked); otherInput.prop('disabled', !checked);
otherInput.prop('required', checked); otherInput.prop('required', checked);
otherLabel.toggleClass('required', checked); otherLabel.toggleClass('required', checked);
otherLabel.css('opacity', checked ? 1 : 0.3); otherTableRow.css('visibility', checked ? 'visible' : 'collapse');
if (checked) { if (checked) {
otherInput.focus(); otherInput.focus();