Files
notifications-admin/app/assets/javascripts/radioSlider.js
2019-12-12 14:16:38 +00:00

29 lines
617 B
JavaScript

(function(global) {
"use strict";
global.GOVUK.Modules.RadioSlider = function() {
this.start = function(component) {
$(component)
.on('click', function() {
valuesInLabel = $(this).find(':checked').next('label').text().split('/');
if (valuesInLabel.length === 2) {
leftValue = valuesInLabel[0];
rightValue = valuesInLabel[1];
$(this).find('.radio-slider-left-value').html(leftValue);
$(this).find('.radio-slider-right-value').html(rightValue);
}
})
.trigger('click');
};
};
})(window);