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> 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 © 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>
Creo que será mejor si usa onclick para llamar a funciones en etiquetas
<a class="getstarted" onclick='my()'>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 © Cryptons API - All right reserved.' }).then((result) => { if (result.isConfirmed) { window.location.href = '/auth/discord/login'; } else if (result.isDenied) { window.location.href = '/'; } }) }