title: set input value equal to div content
body: <p>I've a some dynamic buttons and when I click on them they display the price inside the div with <code>id="prezzo"</code>.</p>
  
  <p>but now I need that, when I click on one of those buttons, they fill the hidden value field of the form with the same <code>"data-prezzo"</code>.</p>
  
  <p>Basically I want that even the form value is dynamic like the div with <code>id="prezzo"</code></p>
  
  <p>Is this possible?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $("input[id^=service]").on("click", getCheck);
    $(".event-hook-class").on("click",function(e) {
      e.preventDefault();
      $(".event-hook-class").removeClass("active");
      $(this).addClass("active")
      $("#prezzo").html($(this).data('prezzo') + ' €');
      $("#form-prezzo").setAttribute("value", $(this).data('prezzo'));
      $("#piano").html('piano: ' + $(this).data('piano'));
      getCheck(); // will add this and the checkboxes
    });
    getCheck(); // initialise on page load
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
    echo '&lt;button type="button" class="event-hook-class simple-text piano" id="'.$id_appartamenti.'" data-prezzo="'.$prezzo_piano.'" data-piano="'.$piano.'"&gt;.$id_appartamenti.' &lt;br&gt; piano '.$piano.'&lt;br&gt; prezzo '.$prezzo_piano.' €&lt;/button&gt;&lt;br&gt;';
  ?&gt;
  
  &lt;p class="paragraph" id="prezzo"&gt; €&lt;/p&gt;
  
  
  &lt;form&gt;
  &lt;input type="hidden" value="" id="form-prezzo" data-name="prezzo"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and a form with this imput field</p>