Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
how to reset a value of a textarea if another input has value

I'm new to JS I have input and textarea I want to reset the textarea's value, if input is changed

<!doctype html>
<HTML lang="en">
<HEAD>
<META charset="utf-8">
<META name="viewport" content="width=device-width, initial-scale=1">
<TITLE>Hello, world!</TITLE>
</HEAD>
<BODY>
<INPUT type="text">
<TEXTAREA>AAAA</TEXTAREA>
</BODY>
</HTML>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can achieve this real quick with Jquery as follows:

$('input').change(function() {
  $('textarea').val('');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<input type="text">
<br/><br/>
<textarea>AAA</textarea>

You can replace .change with .keyup if you want the textarea value to reset immediately input is typed on.

input event triggers:
.change: Fires the moment the value of input is changed or clicked out of.
.keyup: Fires when a key is released on input.
.keydown: Fires when a key is pressed down on input.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Modify your HTML code as follows:

    <!doctype html>
<HTML lang="en">
<HEAD>
<META charset="utf-8">
<META name="viewport" content="width=device-width, initial-scale=1">
<TITLE>Hello, world!</TITLE>
</HEAD>
<BODY>
    <INPUT type="text" id="inputField1" onInput="document.getElementById('textarea1').innerHTML = '';">
    <TEXTAREA id="textarea1" >aaa</TEXTAREA>


</BODY>
</HTML>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda