Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/07/2011, 11:49
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: Seleccionar <img> según su valor.

La documentación en el sitio de jQuery es bastante completa. Acá tenés un resumen de selectores:

http://api.jquery.com/category/selectors/

En jQuery podés seleccionar de acuerdo al valor de un atributo sin problemas. En este caso te interesa el atributo "src". Mirá este ejemplo:

Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  5.   <script>
  6.     $(window).load(function(){
  7.       $('img[src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif"]').animate({
  8.         margin:20,
  9.         width:500
  10.       });
  11.     });
  12.   </script>
  13. </head>
  14. <body>
  15.   <p>  <img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /></p>
  16.     <p>  <img src="  http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Homer_Simpson_in_Cerne_Abbans.JPG/220px-Homer_Simpson_in_Cerne_Abbans.JPG" /></p>
  17.  
  18. </body>
  19. </html>


Como verás sólo se selecciona la imagen con el atributo src especificado.
__________________
nahueljose.com.ar