Hi,
How about:
$("#yourimage").prev("p:last");
I think this should work, let me know if it doesn't.
-- Felix Geisendörfer aka the_undefined
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
Anaurag Gupta wrote:
>> How is it I can traverse to the first previous element from a given
specific
>> element? So if I click on image, I can find from the position
within the DOM
>> of that image, the first paragraph that precedes it?
>This should work:
>$("#yourimage").prev("p");
I don't think that will work for me. For instance, I want to be able
to find it even in this instance:
<body>
<p>don't find me</p>
<table><tr><td><p>don't find me</p></tr></td><td><p>Find
Me!</p></tr></td></table>
<img id="yourimage" src="#" />
<p>don't find me</p>
</body>
Any thoughts would be appreciated.
------------------------------------------------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
<http://us.rd.yahoo.com/evt=45083/*http://advision.webevents.yahoo.com/mailbeta>
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/