##
Generating slider dynamically

The slider can be created dynamically as follows:

    <div class="wrapper" id="wrapper"></div>

    <script src="tcrs-generated-labels.min.js"></script>
    <script src="toolcool-range-slider.min.js"></script>

    <script>
      const $wrapper = document.getElementById('wrapper');

      const $slider = document.createElement('tc-range-slider');
      $slider.setAttribute('min', '-100');
      $slider.setAttribute('max', '100');
      $slider.setAttribute('value1', '10');
      $slider.setAttribute('value2', '50');
      $slider.setAttribute('generate-labels', 'true');
      $wrapper.append($slider);
    </script>

> 📌 An example page with the source code can be found here.

Previous
Events
Next
React & TypeScript