altinn-designsystem
Version:
Altinn Design system based on Pattern Lab.
39 lines (38 loc) • 1.39 kB
JavaScript
/* globals $ */
var feedbackToggle = function() {
if ($('.a-js-feedbackToggle').length > 0) {
$('.a-js-feedbackToggle').closest('fieldset').next().hide();
$('.a-js-feedbackToggle').closest('fieldset').next().next()
.hide();
$('.a-js-feedbackToggle').closest('fieldset').next().next()
.next()
.hide();
$('.a-js-feedbackToggle').each(function() {
$(this).find('input[type=radio]').change(function() {
if ($(this).val() === 'radio1' && $(this).is(':checked')) {
$(this).closest('fieldset').next().show();
$(this).closest('fieldset').next().next()
.hide();
$(this).closest('fieldset').next().next()
.next()
.hide();
} else if ($(this).val() === 'radio2' && $(this).is(':checked')) {
$(this).closest('fieldset').next().hide();
$(this).closest('fieldset').next().next()
.show();
$(this).closest('fieldset').next().next()
.next()
.show();
}
});
$(this).closest('form').find('button').on('click', function() {
$(this).closest('fieldset').next().show();
$(this).closest('fieldset').next().next()
.hide();
$(this).closest('fieldset').next().next()
.next()
.hide();
}.bind(this));
});
}
};