Hi!

I have the following table:

<table width="63%" border="0" align="right" cellpadding="0" cellspacing="0" class="findUsResults">
<tr>
    <th align="left">Company</th>
    <th align="left">Location</th>
    <th align="left">Products offered</th>
    <th align="left">Distance</th>
</tr>
<tr>
    <td rel='1'>Company Ltd</td>
    <td>Town</td>
    <td><a href="/stockists/ajax.php?id=3" class="various fancybox.ajax">Click to view</a></td>
    <td>0.9 mil</td>
</tr>
<tr>
    <td rel='2'>Company Ltd</td>
    <td>Town</td>
    <td><a href="/stockists/ajax.php?id=5" class="various fancybox.ajax">Click to view</a></td>
    <td>11.56 mil</td>
</tr>
<tr>
    <td rel='3'>Company Ltd</td>
    <td>Town</td>
    <td><a href="/stockists/ajax.php?id=1" class="various fancybox.ajax">Click to view</a></td>
    <td>11.67 mil</td>
</tr>
<tr>
    <td rel='4'>Company Ltd</td>
    <td>Town</td>
    <td><a href="/stockists/ajax.php?id=6" class="various fancybox.ajax">Click to view</a></td>
    <td>14.5 mil</td>
</tr>
</table>

And I want to get the rel value when the user clicks on the row but the following code doesnt return anything...

$('.findUsResults tr').css({cursor:'pointer'})
            .click(
                function(){
                    var markerId = $($(this).find('td:nth-child(1)').children()[0]).attr(\"rel\");
                    infowindow.open(map, markerId);
                    console.log(markerId);
                }
);

Help pleasee!
Thanks,
Dan

try this:

var markerId = $(this).children().eq(0).attr("rel");
commented: thanks +2

Thanks mate

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.