For this code it's work good:
<script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"></script>
<textarea style="height: 300px;"></textarea>
<p id="preview"></p>
<script type="text/javascript">
setInterval(function() {
$('#preview').html($('textarea').val());
}, 10);
</script>
But when I change from <p>
to <input
like this:
<script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"></script>
<textarea style="height: 300px;"></textarea>
<input type="text" id="preview">
<script type="text/javascript">
setInterval(function() {
$('#preview').html($('textarea').val());
}, 10);
</script>
Why it's not working? How can I resolve it?