Answer the question
In order to leave comments, you need to log in
How to track the change event in input (change doesn't work for some reason)?
There is a jquery-ui slider.
And also exists
input[name='containers-count']
in which the value from this slider is transferred.
I need to track if there was a change inside the input. My attempt to do it looks like this
$("input[name='containers-count']").change ->
console.log "TEST"
.change
normally works in the first case, and in the second case it does not work at all. Answer the question
In order to leave comments, you need to log in
You can also, if you really want to change, add it to the slide $('#amount').trigger('change');
AND it will work :)
But in general, yes, it's better to just use the slide event.
In this form, change is triggered when you click on enter.
HTML:
JS:
$(function () {
$('#foo').on('change', function () {
console.log('change');
});
});
$(function () {
$('#foo').on('keydown', function () {
console.log('change');
});
});
I understand what the problem is)))
No change will help you here .
You need to refer to the bootstrap-slider function itself https://seiyria.com/bootstrap-slider/
Where they make it clear which variable should be accessed to get it, for example
$('#slider').slider({
formatter: function(value) {
var x = value;
var d = 0.015;
var m = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); // при форматировании числа с запятой 1,000,000
var one = x * Number(d); // умножение с нецелыми числами
$('#text').html(x + ' $');
$('#return').html(one.toFixed().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); // если надо округлить не целое число 4.554849 и вставить запятые как в m
return z;
}
});
<div id="text"></div>
<div id="return"></div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question