Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/04/2014, 23:58
Avatar de Alexis88
Alexis88
Philosopher
 
Fecha de Ingreso: noviembre-2011
Ubicación: Tacna, Perú
Mensajes: 5.552
Antigüedad: 12 años, 5 meses
Puntos: 977
Respuesta: Obtener el valor de un elemento HTML

Utiliza el método getAttribute.

Código Javascript:
Ver original
  1. var enlaces = document.getElementsByClassName("lnk"),
  2.     forEach = Array.prototype.forEach;
  3.  
  4. forEach.call(enlaces, function(a){
  5.     a.addEventListener("click", function(){
  6.         alert(this.getAttribute("title")); //Muestra el título del enlace
  7.     }, false);
  8. });

DEMO

Saludos
__________________
«Juro por mi vida y mi amor por ella, que jamás viviré para el provecho de otro hombre, ni le pediré a otro hombre que viva para el mío».

Ayn Rand