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

156
Views
Cómo llamar a una función en JavaScript cuando se selecciona el botón de opción

Soy nuevo en JavaScript, estoy tratando de llamar a otra función pero no funciona, ¿alguien puede decirme qué estoy haciendo mal? Tengo un botón de radio basado en la selección que quiero llamar a una función.

 const paymentForm = document.getElementById('paymentForm'); paymentForm.addEventListener("submit", myFunction, false); //PaymentMethodRadio: function myFunction() { if (document.getElementById('Once').checked) { payWithPaystack1.call(); } if (document.getElementById('Reoccuring').checked) { } } function payWithPaystack1(e) { e.preventDefault(); let handler = PaystackPop.setup({ key: 'censored', // Replace with your public key email: document.getElementById("email-address").value, amount: document.getElementById("amount").value * 100, ref: '' + Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you // plan: 'censored', subaccount: 'censored', // label: "Optional string that replaces customer email" onClose: function () { alert('Window closed.'); }, callback: function (response) { let message = 'Payment complete! Reference: ' + response.reference; alert(message); } }); handler.openIframe(); }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Trate de usar eventos on o changed

 $(document.getElementById('Reoccuring')).on('click change', function(e) { // your checking statements. if (document.getElementById('Reoccuring').checked) { //checked function } else { // unchecked } });
about 4 years ago · Juan Pablo Isaza Report

0

con una declaración If como esta

 if(document.getElementById('radioButtonID').checked) { // do this }

verifique esta pila, puede ayudar ¿Cómo puedo verificar si un botón de opción está seleccionado con JavaScript?

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!