Determine click position on progress bar?

前端 未结 8 1861
傲寒
傲寒 2021-02-08 19:38

Is it possible to determine the value/position of a user\'s click on a progress bar using plain javascript?

Currently, I can detect a click on the element but can only g

8条回答
  •  名媛妹妹
    2021-02-08 20:14

    For those willing to use a slider instead of a progress bar, obtaining the value would be much easier:

    HTML

    
    

    JavaScript

    const slider = document.getElementById('slider');
    slider.onclick = () => alert('Current value: ' + slider.value);
    

提交回复
热议问题