I have the following html input
tags.
$("input[type='range']::-webkit-slider-thumb").on('hover', function () { //... });
input[type="range"] { height: 0.5rem; box-shadow: 0 0 0.25rem gray; } input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; border: 0; width: 1.25rem; height: 1.25rem; border-radius: 100%; background: #7CB5EC; box-shadow: 0 0 0.375rem gray; cursor: pointer; } input[type="range"]::-moz-range-thumb { -webkit-appearance: none; appearance: none; border: 0; width: 1.25rem; height: 1.25rem; border-radius: 100%; background: #7CB5EC; box-shadow: 0 0 0.375rem gray; cursor: pointer; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <input id="my-range" type="range" min="0" max="100">
I want to get the hover event via JavaScript whenever the user hovers over only the thumb.
I tried doing it like above but it didn't trigger the event. Any help would be greatly appreciated.
Thanks in advance.
I strongly believe that you can't do this using the default html input scope, you have to use a custom input scope like this: