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

129
Views
HTML no lee la función de JavaScript en la etiqueta <script>

Este es mi código idk donde estoy equivocado por favor ayuda!

https://codepen.io/visa2code/pen/oNojdRr

 <a class="getstarted" href='javascript:my()'> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-box-arrow-in-right" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 0-1 0v2A1.5 1.5 0 0 0 6.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-8A1.5 1.5 0 0 0 5 3.5v2a.5.5 0 0 0 1 0v-2z" /> <path fill-rule="evenodd" d="M11.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H1.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" /> </svg></i> &nbsp; &nbsp; Login</a>

Lo que coloqué en la etiqueta del script

 function my() { Swal.fire({ icon: 'info', title: 'Do you agree to our terms and ads policy?', text:'<a href="/terms">Terms</a> and <a href="/ads-policy">Ads Policy</a>, footer: 'Copyright 2022 &copy Cryptons API - All right reserved.' }).then((result) => { if (result.isConfirmed) { window.location.href = '/auth/discord/login'; } else if (result.isDenied) { window.location.href = '/'; } }) }

el error que recibo

 Uncaught ReferenceError: my is not defined

La etiqueta del script se coloca en la etiqueta <head>

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

0

Creo que será mejor si usa onclick para llamar a funciones en etiquetas

 <a class="getstarted" onclick='my()'>
about 4 years ago · Juan Pablo Isaza Report

0

prueba esto:

 function my() { Swal.fire({ icon: 'info', title: 'Do you agree to our terms and ads policy?', text:'<a href="/terms">Terms</a> and <a href="/ads-policy">Ads Policy</a>', footer: 'Copyright 2022 &copy Cryptons API - All right reserved.' }).then((result) => { if (result.isConfirmed) { window.location.href = '/auth/discord/login'; } else if (result.isDenied) { window.location.href = '/'; } }) }
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!