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

137
Views
Marque y desmarque las casillas de verificación con un botón en js

Mi objetivo es que el botón "kampfende" restablezca las casillas de verificación debajo de la identificación "aktionspunkte". He leído que una función de reinicio no funciona con casillas de verificación, por eso lo probé con if/else, pero no sucede nada en este momento.

Un poco más sobre el código: El botón "Nächste Runde" le dice al usuario que agregue 3 ap a los actuales y establece el contador "Kamprunden" en +1. Eso funciona totalmente bien. El botón "kampfende" restablece el contador "Kampfrunde", que también funciona bien.

No estoy seguro si puedo construir el if-else en la función de reinicio y también si puedo escribir dos funciones para un botón.

¡Sería bueno si me puedes ayudar!

código actual:

 var kampfrundencounter = (function() { var runde = 1; return function(reset = false) { runde = reset ? 1 : runde + 1 return runde; } })(); function rundeErhöhen() { document.getElementById("kampfrundencounter").innerHTML = kampfrundencounter(); alert("Füge 3 Aktionspunkte zu deinen hinzu"); } function reset() { document.getElementById("kampfrundencounter").innerHTML = kampfrundencounter(true); //maybe here the if-else-part like: if the ap1- checkbox is uncheck then check it, if the ap2 checkbox is uncheck then check it, ...., if the ap5 is checked then uncheck it, .... }
 <div id = "Aktionspunkte"> <!--AKtionspunkte + Checkboxen--> <input type="checkbox" name="aktionspunkt" id="ap1" checked> <input type="checkbox" name="aktionspunkt" id="ap2" checked> <input type="checkbox" name="aktionspunkt" id="ap3" checked> <input type="checkbox" name="aktionspunkt" id="ap4" checked> <input type="checkbox" name="aktionspunkt" id="ap5"> <input type="checkbox" name="aktionspunkt" id="ap6"> <input type="checkbox" name="aktionspunkt" id="ap7"> <input type="checkbox" name="aktionspunkt" id="ap8"> </div> <div> <!--Kamprundencounter--> <button type="button" id="neueRunde" onclick="rundeErhöhen()">Nächste Runde</button> <button type="button" id="kampfende" onclick="reset()">Kampfende</button> <p>Aktuelle Runde: <a id="kampfrundencounter">1</a> </p> </div>

about 4 years ago · Juan Pablo Isaza
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!