Sorry for the loads of emails.

Using your exact code setup, this is what I came up with:
$('div.data a').click( function() {
        var lat =
$(this).parent().parent().children('.editable').children('span').attr('name'
,'longitude').html();
        alert(lat);
        return false;
});


 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of SiCo
Sent: Friday, April 20, 2007 12:55 PM
To: jQuery (English)
Subject: [jQuery] Retrieving information outside of $this


I have a small problem, probably more to do with me not knowing more than
anything else!!

My structure is like so:

<div class="main loc" rel="album" name="17"> <h3>Los Angeles</h3> <div
class="data"> <div class="editable" name="17"><b>Latitude:</b> <span
name="latitude">34.052019404448785</span><br /> <b>Longitude:</b> <span
name="longitude">-118.24318885803223</span>
</div>
<p>
<img src="trip-goto.gif" name="goto" rel="" width="16" height="16"
border="0" alt="View this location on the map." title="View this location on
the map." /> <a href=""><img src="trip-remove.gif" width="16" height="16"
border="0" alt="Remove this album from the trip." title="Remove this album
from the trip." /></a> </p> </div> </div>

Clicking on each of these blocks (multiple blocks per list) changes it to an
editor and you can select on aGoogle Map the location and it updates etc.

Now what I want is when the trip-goto.gif img is clicked I want the map to
scroll to the lat and long held in the span. What I can't work out is in the
click event how to grab the lat and long from the span tags... either
traversing the tree backwards etc or another way. I can't / don't want to
use id's as there can be 20 of these per page in ahierachical fashion so I'd
rather work with '$this'...

Any thoguhts? I am sur eit's easy...

Thanks
Simon


Reply via email to