Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/04/2012, 22:53
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Elegir el texto de un elemento con atributo determinado

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  7. </head>
  8. <ul>
  9. <li><a href="#" id="FR">France</a></li>
  10.  <li><a href="#" id="BR">Brazil</a></li>
  11.  <li><a href="#" id="DE">Germany</a></li>
  12.  <li><a href="#" id="IN">India</a></li>
  13.  </ul>
  14. <script type="text/javascript">
  15. //<![CDATA[
  16. $("li a").click(function(event) {
  17. var pais = $(this).html();
  18. alert(pais);
  19. });
  20. //]]>
  21. </script>
  22. </body>
  23. </html>

__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.