copy div to hidden input

by magizter

HTML

<input type="text" id="osszeg">
  
  <div id="div">
  Summa
  </div>
  <br><br>
  Imagine this one below is the hidden one<br>
  
  <textarea id="hidden-input"></textarea>

JavaScript

$('#osszeg').keyup(function() {
      var copy = $('#div').html();
      $('#hidden-input').html( copy );
  });