Add event handlers for dynamically added neo-range-inputs

This commit is contained in:
Cohee
2024-08-06 22:28:37 +03:00
parent 444339e156
commit d6e7fd78ad

View File

@ -10745,15 +10745,17 @@ jQuery(async function () {
var isManualInput = false;
var valueBeforeManualInput;
$('.range-block-counter input, .neo-range-input').on('click', function () {
$(document).on('input', '.range-block-counter input, .neo-range-input', function () {
valueBeforeManualInput = $(this).val();
console.log(valueBeforeManualInput);
})
.on('change', function (e) {
});
$(document).on('change', '.range-block-counter input, .neo-range-input', function (e) {
e.target.focus();
e.target.dispatchEvent(new Event('keyup'));
})
.on('keydown', function (e) {
e.target.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true }));
});
$(document).on('keydown', '.range-block-counter input, .neo-range-input', function (e) {
const masterSelector = '#' + $(this).data('for');
const masterElement = $(masterSelector);
if (e.key === 'Enter') {
@ -10775,14 +10777,16 @@ jQuery(async function () {
}
}
}
})
.on('keyup', function () {
});
$(document).on('keyup', '.range-block-counter input, .neo-range-input', function () {
valueBeforeManualInput = $(this).val();
console.log(valueBeforeManualInput);
isManualInput = true;
})
});
//trigger slider changes when user clicks away
.on('mouseup blur', function () {
$(document).on('mouseup blur', '.range-block-counter input, .neo-range-input', function () {
const masterSelector = '#' + $(this).data('for');
const masterElement = $(masterSelector);
let manualInput = Number($(this).val());