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

162
Views
Cómo establecer el valor del botón de opción como situación marcada o no marcada
<input type="radio" name="imgsel" value="" checked />

Mi requisito es: este botón de opción está marcado de forma predeterminada, luego el valor de este botón está 'presente'. Cuando este botón no está marcado, el valor de este botón es 'ausente'. ¿Cómo puedo hacer esto?

por favor, ayúdame . Gracias por adelantado .

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

 function valChange(element) { if (element.checked) { alert("present"); } else { alert("absent"); } }
 <input id="button" type="checkbox" name="imgsel" onchange="valChange(this)" value="" checked />

about 4 years ago · Juan Pablo Isaza Report

0

El siguiente ejemplo reemplaza el valor de la casilla de verificación cuando se hace clic. Primero, el evento de clic debe estar vinculado a la casilla de verificación. EventHandler comprueba si la casilla ya se ha marcado. Si no, lo comprueba y establece el valor en la casilla de verificación. Y si no se ha comprobado, al revés.

 let i = document.querySelector('input'); i.addEventListener('click', (ev) => { let el = ev.target; if (el.getAttribute('checked') === null) { el.setAttribute('checked', true); el.value = "present" } else { el.removeAttribute('checked'); el.value = "absent" } let checkValue = document.querySelector('input').value alert(checkValue) })
 <input type="radio" name="imgsel" value="" checked />

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!