Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2011, 13:57
Avatar de tomymolina
tomymolina
 
Fecha de Ingreso: noviembre-2010
Mensajes: 50
Antigüedad: 13 años, 6 meses
Puntos: 1
Sonrisa Problema each y if

Tengo varios elementos a con una misma clase pero distinto enlace (href) y quiero comprobar cual de ellos tiene un enlace determinado. Algo así

Código HTML:
<a class="title" href="google.es">
<a class="title" href="facebook.com">
<a class="title" href="tuenti.com">
<a class="title" href="forosdelweb.com"> 
Y luego el jquery:

Código HTML:
	$("a.title").each(function(i){

		
   elemento = $(this);
   if(elemento.attr("href") == "tuenti.com")
   {
      alert("si! Hay hay un enlace a tuenti.");
   }