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

126
Views
¿Cómo pasar onclick="function(name)" en la etiqueta </a> y luego obtener el valor por nombre de javascript?
<?php $currency = file_get_contents('https://api.pro.coinbase.com/currencies'); $result = json_decode($currency); $totalCurrency = array(); foreach($result as $key){ if($key->details->type == 'crypto'){ array_push($totalCurrency, $key); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Aditya Dev ~~ Coinbase Deposit By PHP</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> </head> <body> <div class="main"> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown button </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1"> <?php foreach($totalCurrency as $key): ?> <li><a class="dropdown-item" href="#"><?= $key->id; ?></a></li> <?php endforeach; ?> </ul> </div> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> <script src="index.js"></script> </body> </html>

En PHP, busco todos los símbolos de criptomonedas de la API y los almaceno aquí en esta línea $totalCurrency = array(); y luego ejecuto un bucle para crear una lista desplegable como esta ingrese la descripción de la imagen aquí

Quiero que si hago clic en cualquier moneda desde allí javascript envíe una alerta como esta alert(symbol)

Estoy bastante confundido acerca de cómo hacer esto, no es un botón su etiqueta, por favor ayúdenme

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!