wiki-grav/plugins/admin/themes/grav/app/forms/fields/range.js
2022-04-24 14:32:58 +02:00

11 lines
382 B
JavaScript

import $ from 'jquery';
$(document).on('input', '[type="range"].rangefield, [type="number"].rangefield', (event) => {
const target = $(event.currentTarget);
const type = target.attr('type').toLowerCase();
const sibling = type === 'range' ? 'number' : 'range';
const feedback = target.siblings(`[type="${sibling}"].rangefield`);
feedback.val(target.val());
});