I'm having a textarea, and at the time you type the text will appear in the html image do you understand? Type this
I wanted to know how I can make my text break it in the other div from the moment I give an enter in textarea.With Jquery.
Use the pre
tag within the div.
<pre> - HTML | MDN
is the tag used to represent preformatted text. A text within this element is typically displayed in a non-proportional font in the same way that the original text was placed in the file. Blank spaces are kept in the text the same way they were typed.
$(function() {
$origem=$("#origem");
$saida=$("#saida");
$origem.keyup(function() {
$saida.text($origem.val());
});
});
body { color:#ffffff}
#origem { width:250px; height:5em;}
#saida {
font-family: Arial Black; font-size: 14px;
}
.imagemDeFundo{
background: url('https://thumbs.dreamstime.com/t/textura-do-grunge-do-quadro-negro-36176292.jpg') no-repeat;
height:400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><textareaid="origem"></textarea>
<div class="imagemDeFundo"><pre id="saida"></pre></div>