如何在jquery中输入textarea时显示文本

如何在jquery中输入textarea时显示文本

问题描述:

我正在寻找一种方式来预览文本,同时在jquery中输入textarea

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

正是你用于Stackoverflow的内容,

exactly what u are using for Stackoverflow ,

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

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

当您在< textarea> $ c $中输入文字c>,文本应复制到< div> 的HTML中。

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