I want to convert the first text box to uppercase and lowercase, according to me my function is fine but I don't know how to print the result in the text box below. Every time I click on the button the page is reloaded and the text in the box is deleted
function mayus() {
var resultado
var inicio
var inicio = document.getElementById('original');
var resultado = inicio.toUpperCase();
document.getElementById('resultado'.innerHTML = resultado)
};
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="/js/script.js"></script>
</head>
<body>
<noscript>
<p>
Bienvenido
</p>
<p>
La página que estás viendo requiere para su funcionamiento el uso de JavaScript. Si lo has deshabilitado intencionadamente,
por favor vuelve a activarlo.
</p>
</noscript>
<form name="formulario" id="inicial">
<input type="text" id="original"/><br>
<input type="text" id="resultado" /><br>
<input type="submit" value="MAYUSCULA" onclick="mayus()" ><br>
<input type="submit" value="minuscula">
</form>
</body>
</html>
Reviewing I identify you that:
1) Does nothing because the variable
inicio
was not saving the value(value) of the text box2) In my particular I assign the direct value to the HTML element I do not use append
3) submit must be buttons
4) In case you want it;