Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
¿Cómo puedo hacer que el texto ingresado y el texto de la casilla de verificación vayan al mismo campo de texto?

cuando se ingresa el nombre del proyecto, se completa en el mismo campo de texto que el texto de las casillas marcadas pero en la parte superior del campo.

También quiero crear un botón para enviar el formulario completo si es posible

html

 <div class="name"> <form> <label for="projectname">Project name:</label> <input type="text" id="pname" name="pname"><br> <br> </div> <br> <div class="series1"> <tr><input type="checkbox" rel="textbox1" name="Cabinets" class=test/> Cabinets</tr> <input type="checkbox" rel="textbox1" name="Doors" /> Doors <input type="checkbox" rel="textbox1" name="Drawers"> Drawers <input type="checkbox" rel="textbox1" name="Drawer Fronts"> Drawer Fronts <input type="checkbox" rel="textbox1" name="Handles"> Handles </div> <textarea id="textbox1" ></textarea>

js

 $('input:checkbox').click(function(){ var tb = "#"+$(this).attr('rel'); let text_to_add = this.name + "\n"; //when click a checkbox and show checked items in the text area if($(this).is(":checked")){ $(tb).append(text_to_add); }else{ let remove = this.name +"\n"; //when a box is unchecked it clears the previously populated text from checkbox $(tb).text(function(i, text){ return text .replace(text_to_add,''); }); } })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La solución que se me ocurriría sería: almacenar el valor existente del área de texto cada vez que cambie el valor del área de texto.

 let existValue = '' //inside the checkbox click function: existValue = $(tb).val()

luego para agregar un detector de eventos a la entrada y cada vez que la entrada cambie para agregar e.target.value al valor existente que creamos antes

 $('#pname').on('input', (e)=>{ $('#textbox1').val(`${e.target.value}\n${existValue}`) })

aquí hay un ejemplo de trabajo: ejemplo de trabajo

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!