vendredi 25 septembre 2020

Change import data displayed depending on slider value

I'm trying to find a way to change var "prezzo" depending on value of slider. Var "prezzo" has to import data form acf plugin and I can load that value with get_field function but i can't build the IF statemente to change that value to import. Thanks in advance to everyone could help me showing the right code

var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
var prezzo = document.getElementById("demoprezzo");
output.innerHTML = slider.value; // Display the default slider value

// Update the current slider value (each time you drag the slider handle)
slider.oninput = function() {
  output.innerHTML = this.value;
//  if (slider = 12) {    I can't go on 
   
}

// This is the function to import data from acf plugin. It works
//<?php

//$variable = get_field('prezzo');

//echo $variable
  
//?>
<h1>Durata</h1>
<div class="slidecontainer">
  <input type="range" min="12" max="36" value="12" step="12" class="slider" id="myRange">
  <p>Value: <span id="demo"></span></p>
  <p>Prezzo: <span id="demoprezzo"></span></p>
</div>

Aucun commentaire:

Enregistrer un commentaire