1

On page load time IonRangeSlider is Disable using disable : true once page load successfully then i will click on slider and it should ne enable and set position.

What should I do ? Using Jquery and JavaScript.

Bhargav Patel
  • 1,098
  • 10
  • 23
Ravi Patel
  • 51
  • 5

1 Answers1

2

You need to bind a click event to your slider element, but since you cannot bind click events to elements that are disabled, you must bind this event to the parent instead. When the parent is clicked, you would then target the slider and update the disabled property, as demonstrated below.

$('input').parent().on('click', function () {
  var $slider = $(this).find('input');
  //$slider.update({"disable": false});
  alert('The slider was clicked!');
});
.container {
  display: inline-block;
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<div class="container">
  <input type="text" disabled />
</div>
Adam Chubbuck
  • 1,612
  • 10
  • 27
  • 1
    I don't think we can get click event on disable element. Because disable element don't fire mouse events. – Bhargav Patel Aug 30 '18 at 10:18
  • @BhargavPatel You are correct. I have revised my answer. Thank you for pointing that out. – Adam Chubbuck Aug 30 '18 at 13:42
  • @RaviPatel Please mark this answer as correct if this has solved you issue. Otherwise, please let me know so that I can further assist you in finding an appropriate solution. – Adam Chubbuck Aug 30 '18 at 17:16