-3
I’m making a text editing HTML5 site, in it Oce types something in the text box and selects one of the desired options, 'Uppercase, Lowercase, Bold, Italic, Fixed, Strike, Sub, Sup'. The problem starts when I try to use the 'Bold, Italic, Fixed, Strike, Sub, Sup' buttons, the message returns in the response box between '< b> < /b>, < i> < /i>, < tt> < /tt>, < strike> < /strike>, < sub> < /sub>, < sup> < /sup>' respectively, instead of returning with the text effect. I hope I’ve been clear with my problem, I really appreciate the help!
Below is the HTML5 code
<!DOCTYPE html>
<html lang="ue">
<head>
<meta charset="UTF-8">
<meta name="description" content="site para edição de texto simples">
<meta name="keywords" content="editar texto, correção de texto, texto, edição">
<meta name="author" content="@sir_membrive">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Character Transition</title>
<link rel="stylesheet" href="estilo.css">
</head>
<body>
<section>
<h1>Character Transition</h1>
<div>
<p id="paragrafo1">
<input type="button" class="botao" value="Uppercase" onclick="maiusculas()">
<input type="button" class="botao" value="Lowercase" onclick="minusculas()">
<input type="button" class="botao" value="Bold" onclick="negrito()">
<input type="button" class="botao" value="Italic" onclick="italico()">
<input type="button" class="botao" value="Fixed" onclick="fixo()">
<input type="button" class="botao" value="Strike" onclick="riscado()">
<input type="button" class="botao" value="Sub" onclick="sub()">
<input type="button" class="botao" value="Sup" onclick="sup()">
<input type="button" class="botao" value="Number of Characters" onclick="letras()">
</p>
<p>
<textarea id="texto" placeholder="Type the text:"></textarea>
</p>
</div>
<textarea id="res"></textarea>
</section>
<footer>
<p>© Designed by @sir_membrive</p>
</footer>
<script src="script.js"></script>
</body>
</html>
Below is the Javascript code
function maiusculas() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.toUpperCase()
}
function minusculas() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.toLowerCase()
}
function negrito() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.bold()
}
function italico() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.italics()
}
function fixo() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.fixed()
}
function riscado() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.strike()
}
function sub() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.sub()
}
function sup() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = texto.sup()
}
function letras() {
var texto = document.getElementById('texto').value
var res = document.getElementById('res')
res.innerHTML = `Your text has ${texto.length} characters, including spaces, letters and punctuation.`
}
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco