Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
How to make a range update a label with the value and move another range on Safari?

I have two range sliders that display the value in the label when they slide. They also adjust each other to prevent a backwards range. It works in FireFox {99.0.1 (64-bit)} (Mac OS) but not in Safari{15.4.1} (iPhone)

           <h6>Age range you prefer</h6>
            <label for="Youngest" id="youngestlabel" class="form-label">Youngest Age: (<?php if(!empty($UserLookingForYoungest)){echo $UserLookingForYoungest;}else{echo "18";}?>)</label>
            <input type="range" class="form-range" id="Youngest" name="Youngest" min="18" max="80" step="1"
                   value="<?php if(!empty($UserLookingForYoungest)){echo $UserLookingForYoungest;}else{echo "18";}?>"
                   onchange="UpdateOldest(this.value)"
                   onmousemove="document.getElementById('youngestlabel').innerHTML='Youngest Age: (' + this.value + ')';">

              <br />
              <label for="Oldest" id="oldestlabel" class="form-label">Oldest Age: (<?php if(!empty($UserLookingForOldest)){echo $UserLookingForOldest;}else{echo "80";}?>)</label>
            <input type="range" class="form-range" id="Oldest" name="Oldest" min="18" max="80"  step="1"
                   value="<?php if(!empty($UserLookingForOldest)){echo $UserLookingForOldest;}else{echo "80";}?>"
                   onchange="UpdateYoungest(this.value)"
                   onmousemove="document.getElementById('oldestlabel').innerHTML= 'Oldest Age: (' + this.value + ')';">

and the javascript:

<script>
function UpdateOldest(newvalue){
 var OldestAge = document.getElementById('Oldest').value;

if(newvalue >= OldestAge){
    updateValue = parseInt(newvalue) + 1;
    document.getElementById("Oldest").value = updateValue;
    document.getElementById('oldestlabel').innerHTML= "Oldest Age: (" + updateValue + ")";
   }};


function UpdateYoungest(newvalue){
var YoungestAge = document.getElementById('Youngest').value;
    if(newvalue <= YoungestAge){
    updateValue = parseInt(newvalue) - 1;
    document.getElementById("Youngest").value = updateValue;
    document.getElementById('youngestlabel').innerHTML= "Youngest Age: (" + updateValue + ")";
   }};
</script>

So, whats the deal with Safari and range sliders?

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda