This could be a poor html design issue and I would try to change it to
start. But if you are stuck with what you have you can try something
like this:

$("img[src$='first.gif']");

For more info check out: http://docs.jquery.com/Selectors

This is untested as always. Good luck

Allex

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of yo2lux
Sent: Wednesday, November 12, 2008 1:33 PM
To: jQuery (English)
Subject: [jQuery] Select a tricky image with jQuery.


I have some image on webpage:

<img class="imagefield" height="310" width="310" title="" alt="" src="/
sites/default/files/first.gif"/>

<img class="imagefield" height="310" width="310" title="" alt="" src="/
sites/default/files/second.gif"/>

<img class="imagefield" height="310" width="310" title="" alt="" src="/
sites/default/files/third.gif"/>

I need to set an event listener only on the first image.
- I think, $('.imagefield') is not a good solution, because set the
event listener on all image.

Is possible to set the event listener using the image name ? For
example: first.gif ?

Sorry I have a complicated situation, the html editing is not allowed
at all. Somehow I need to select the first image with jquery.

Thanks!

Reply via email to