crybaby,

Given the following markup:

<table border="1">
    <tr link="site.com/tutorial/1"><td>Row 1 Cell 1</td><td>Row 1 Cell
2</td></tr>
    <tr link="site.com/tutorial/1"><td>Row 2 Cell 1</td><td>Row 2 Cell
2</td></tr>
</table>

you could do something like this:

$(function(){
    $("tr[link]").bind("click", function(){
        var link = $(this).attr("link");
        window.location.href = link;
    });
});

In case you hadn't see this before, the
$(function(){
   // put all your jQuery goodness here.
});

bit of the code is short hand for

$(document).ready(function() {
    // put all your jQuery goodness in here.
});

I hope this helps. If not, ping us back and keep askin' :o)

Cheers
Chris


On 10/20/07, crybaby <[EMAIL PROTECTED]> wrote:
>
>
> I need to have each table rows point to different link.  I am looking
> at table striping and how hover works in 15daysofjquery.com.
>
> http://15daysofjquery.com/table-striping-made-easy/5/
>
> I need to make the whole table row clickable and should take the user
> to a different link on the site.
> How do I do this in jquery?
>
> For example table is as follows:
> <table border="1">
> <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
> <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
> </table>
>
> Row1 link: site.com/tutorial/1
> Row2 link: site.com/tutorial/2 and so on.
>
>


-- 
http://cjordan.us

Reply via email to