On a range input's mousedown
event, is there a way to determine whether the user clicked on the "knob" of the range input, or the surrounding slider track?
It seems like this might be possible, I'm just not sure what attribute to look at. See the JS console below. First I click the knob, triggering mousedown
, then click
. Then, I click the slider, triggering mousedown
, then input
(because the value changes with this action), then click
.
I'm logging out the event object like this:
onMouseDown(e) {
console.log('mousedown!', e);
}
You can see it looks slightly different when I click the knob vs the slider track, but this may not be meaningful. Is there a differentiating piece of data I can grab onto here?
This is related to an older question: Prevent mousedown event on input range html element and still let user drag slider