It seems like you're looking for a way to hide the range label when the value is below 50. Below is a code sample along with a demo to help you achieve that.
Using Plain JavaScript
// When the document is loaded
document.addEventListener("DOMContentLoaded", function() {
var rangeLimit = 50;
function rangeValueListener(event) {
var rangeElement = event.target || event.srcElement;
setRangeLabelValue(rangeElement);
}
function setRangeLabelValue(rangeElement) {
var rangeLabelElement = document.querySelector(
'label[for="' + rangeElement.id + '"]'
);
var rangeValue = rangeElement.value;
rangeLabelElement.innerText = rangeValue + "%";
if (rangeValue < rangeLimit) {
rangeLabelElement.style.display = "none";
} else {
rangeLabelElement.style.display = "initial";
}
}
var rangeElement = document.querySelector("#myRange");
rangeElement.addEventListener("input", rangeValueListener);
rangeElement.addEventListener("change", rangeValueListener);
setRangeLabelValue(rangeElement);
});
Code snippet using jQuery (adapted from the above)
$(document).ready(function() {
var rangeLimit = 50;
var rangeDefaultValue = 65;
function rangeValueListener(event) {
setRangeLabelValue(event.target);
}
function setRangeLabelValue(rangeElement) {
var rangeElementId = rangeElement.id || rangeElement.attr("id");
var rangeLabelElement = $('label[for="' + rangeElementId + '"]');
var rangeValue = rangeElement.value || rangeDefaultValue;
rangeLabelElement.text(rangeValue + "%");
if (rangeValue < rangeLimit) {
rangeLabelElement.hide();
} else {
rangeLabelElement.show();
}
}
var rangeElement = $("#myRange");
rangeElement.on("input change", rangeValueListener);
setRangeLabelValue(rangeElement);
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Document</title>
</head>
<body>
<input id="myRange" type="range" min="0" max="100" step="1" value="65" />
<label for="myRange"></label>
</body>
</html>