How do I treat input text as string even though they are html tags?
Ex: if I type
<b>texto</b>
In an input field without treatment it appears so text , but I want it written anyway:
<b>texto</b>
How do I treat input text as string even though they are html tags?
Ex: if I type
<b>texto</b>
In an input field without treatment it appears so text , but I want it written anyway:
<b>texto</b>
In pure javascript you can do this:
texto.onkeyup = function() {
resultado.textContent = this.value
}
<input type="text" id="texto">
<div id="resultado">
</div>
In jQuery:
$('#texto').keyup(function() {
$('#resultado').text($(this).val());
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><inputtype="text" id="texto">
<div id="resultado"></div>