title: insert a dynamic value inside
body: <p>I have a range slider and i want its <code>max value</code> to be set equal to <code>value</code> of the <code>id="form-prezzo"</code> input. This last value is dynamically generated.</p>
  
  <p>Is this even possible?</p>
  
  <p>I don't know how to set the <code>max:$form("prezzo").val,</code> </p>
  
  <p>here's my code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const $mutuo = $("#mutuo"),
        $rata = $("#rata"),
        $anni = $("#anni"),
        $slider1 = $("#slider1"),
        $slider2 = $("#slider2"),
        $max = $("#prova");
  
      function update() {
        let interesseannuo = 1.60,
          C = $("#form-prezzo").val(),
          anni = $anni.val(),
          i = interesseannuo / 12 / 100,
          n = anni * 12,
          rata = C * i / (1 - Math.pow(1 + i, -n));
  
        $rata.html(rata.toFixed(2) + " €");
      }
  
      $slider1.slider({
        //max: 100000-(100000/100*20),
        max: $max.html(),
        min: 0,
        step: 10,
        slide: function(event, ui) {
          $mutuo.val(ui.value);
          update();
        }
      });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css"&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js" type="text/javascript"&gt;&lt;/script&gt;
  
  
  
  
  
  &lt;div class="info-paragraph black" id="prova"&gt;1000&lt;/div&gt;
  &lt;p class="info-paragraph black"&gt;Totale mutuo (€)&lt;/p&gt;
  &lt;div id="slider1"&gt;&lt;/div&gt;
  &lt;input class="info-paragraph black" type="text" id="mutuo" value="0"&gt;&lt;br&gt;</code></pre>
  </div>
  </div>
  </p>