webseite-grav/plugins/admin/themes/grav/app/forms/fields/range.js

11 lines
382 B
JavaScript
Raw Normal View History

2021-04-30 11:23:26 +02:00
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());
});