Issue on Binding jQuery UI Slider with Checkbox Event
I am able to check and uncheck some checkboxes on jQuey ui slider stop() using following code. But this looks like is not adding any event to the check boxes!. As you can see the check boxes are re-acting against direct check in out by logging on console but doing nothing when slider change. Can you please let me know why this is happening and how I can fix this?
- $(function() {
- $("#slider-range").slider({
- range: true,
- min: 50,
- max: 54,
- values: [50, 54],
- stop: function(event, ui) {
- var selected = [];
- $('input:checkbox[name=temple]').prop("checked", false);
- $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
- for (var i = ui.values[0]; i <= ui.values[1]; i++) {
- selected.push(i);
- }
- $.each(selected, function(index, value) {
- $("input:checkbox[name=temple][value=" + value + "]").prop("checked", true);
- })
- }
- });
- $("#amount").val("$" + $("#slider-range").slider("values", 0) +
- " - $" + $("#slider-range").slider("values", 1));
- });
- $('input:checkbox[name=temple]').on('change', function() {
- if ($(this).is(':checked')) {
- console.log('Checked');
- } else {
- console.log('Un Checked');
- }
- });