I'm trying to find a way to add a class testing
to a button if the input has a aria-valuenow
is 0.
My code so far:
(function() {
if($('.plyr__volume input').attr('aria-valuenow')=="0"){
$('.js-volume').addClass('test');
} else {
$('.js-volume').removeClass('test');
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button type="button" class="plyr__control js-volume" data-plyr="mute"></button>
<div class="plyr__volume">
<input data-plyr="volume" type="range" min="0" max="1" step="0.05" value="1"
autocomplete="off" role="slider" aria-label="Volume" aria-valuemin="0"
aria-valuemax="100" aria-valuenow="0" id="plyr-volume-2587" style="--value:0%;
width: 0px; left: 200px;" aria-valuetext="0.0%" class="plyr__tab-focus">
</div>