20 lines
637 B
HTML
20 lines
637 B
HTML
|
<form>
|
||
|
<input type="text" name="text" id="text" onkeyup="showindiv()">
|
||
|
</form>
|
||
|
<div id="content"></div>
|
||
|
<script>
|
||
|
window.onload= function(){
|
||
|
if(document.getElementById('text').value ===''){}
|
||
|
else{
|
||
|
let text = document.getElementById('text').value
|
||
|
let ntext = text.replace('\n','<br>')
|
||
|
document.getElementById('content').innerHTML = ntext
|
||
|
}
|
||
|
}
|
||
|
function showindiv(){
|
||
|
let text = document.getElementById('text').value
|
||
|
let ntext = text.replace('\n','<br>')
|
||
|
document.getElementById('content').innerHTML = ntext
|
||
|
}
|
||
|
</script>
|