To reset the slider if a specific div class is clicked, you can use the following code:

$('.reset-button').click(function() {
  $( '#slider-range' ).slider('values', [0, 50000000]);
  $( '#amount' ).html( '$' + $( '#slider-range' ).slider( 'values', 0 ) + ' - $' + $( '#slider-range' ).slider( 'values', 1 ) );
  
  // Reset handle popups with default values
  $('#slider-range .ui-slider-handle').each(function() {
    $(this).attr('data-value', $(this).slider('value'));
  });
  
  // Reset other elements if needed
  $('#qp_has_price').attr('data-value', '');
  $('.qq_price_range .qq_selected_terms').html('');
  
  $('.qq_clear_all_filters').prop('disabled', true);

  setQueryStringParameter('price', '');
  qq_call_loads();
});

This code assumes that you have a div element with a class 'reset-button' that you want to use to reset the slider. You can replace 'reset-button' with your desired class name.

jQuery Slider Reset: How to Reset a Range Slider with a Click

原文地址: https://www.cveoy.top/t/topic/qf6t 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录