Mac Taylor
Mac Taylor

Reputation: 5168

how to show text while typing in textarea in jquery

i looking for a way to preview the text while im typing in a textarea in jquery

exactly what u are using for Stackoverflow ,

Upvotes: 10

Views: 11217

Answers (1)

Justin Niessner
Justin Niessner

Reputation: 245449

<script>
  $(document).ready(function () {
    $('#someTextBox').keyup(function(){
      $('#target').html($(this).val());
    });
  });
</script>

<textarea id="someTextBox"></textarea>
<div id="target"></div>

As you type text in the <textarea>, the text should be duplicated in the HTML of the <div>.

Upvotes: 22

Related Questions