Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
How can user trigger links (Slide the ball and mouse up to open that range link) without clicking the button 'Take me to my ideal object!'?

How can user trigger links without clicking the button 'Take me to my ideal object!' or how can user open a link on slider value change or on mouseup ? Basically user Slide the ball and mouse up to open that range link.

// Setting custom points to slider
var values = [0, 1000,2000,4000,10000];

var input = document.getElementById('tierslider'),
    output = document.getElementById('tierslider2');
    
input.oninput = function(){
    output.innerHTML = values[this.value];
};

input.oninput();

// Redirect 
function redirectToLinks(elem){
  window.location.href = elem.dataset.baselink + values[input.value];
}
<div id='slidecontainer'>
      <form>
          <span>500</span>
          <input type='range' min='0' max='4' value="0" step="1" id='tierslider'>
          <span>10000</span>
          <span id='tierslider2'></span>
      </form>
</div>

<a href='#' data-baselink='http://www.example.com/page?param=' id='DisplaySliderResult' onclick="redirectToLinks(this)">Take me to my ideal object!</a>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Range sliders are kind of weird, but you're on the right track - why not change your 'oninput' function and use [addEventListener] to listen to a change event (instead of an input event)?

In the same way you've updated the value of the tierslider2 span, you can call you redirect function when this event fires. Event handlers are just that - you get to run your own custom event handling code in them.

// Setting custom points to slider
var values = [0, 1000,2000,4000,10000];

var input = document.getElementById('tierslider'),
    output = document.getElementById('tierslider2'),
    myLink = document.getElementById('DisplaySliderResult');
    


// Redirect 
function redirectToLinks(elem){
  window.location.href = elem.dataset.baselink + values[input.value];
}

input.addEventListener('change', function() {
    // you've already 'handled' this event - now just do what you want! in your case, redirect the user to some other place without them clicking the link
    output.innerHTML = values[this.value];
    redirectToLinks(myLink);
});
<div id='slidecontainer'>
      <form>
          <span>500</span>
          <input type='range' min='0' max='4' value="0" step="1" id='tierslider'>
          <span>10000</span>
          <span id='tierslider2'></span>
      </form>
</div>

<a href='#' data-baselink='http://www.example.com/page?param=' id='DisplaySliderResult' onclick="redirectToLinks(this)">Click to take me to my ideal object!</a>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!