Or, without using an ID, you could do it this way:

$(document).ready(function() {
    $("a").click(function() {
        $(this).parents("tr").siblings().removeClass("highlight");
        $(this).parents("tr").addClass("highlight");
    }
});

Might want a return false in there, too.

And it might not work as expected if you have nested tables.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jan 8, 2007, at 4:15 PM, Olaf Bosch wrote:

CARLOS BOTERO schrieb:
Im trying to highlight the parent row of the link on click, that part is working fine, what i need to do is to deselect the highlighted row once another link of a new row is clicked, if you have any suggestions please
let

try this, give the Table a ID
<table id="tableid">

<script type="text/javascript">
$(document).ready(function() {
    $("a").click(function() {
        $("#tableid tr").removeClass("highlight");
        $(this).parents("tr").addClass("highlight");
    }
});
</script>
--
Viele Grüße, Olaf

-------------------------------
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
-------------------------------

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to