Carlos,

Try this:

    $("a").click(function() {
        $("tr").removeClass("highlight");  // removes highlight class from all 
TRs
        $(this).parents("tr").addClass("highlight");  // adds it to selected
    });


________
SEAN O



CARLOS BOTERO wrote:
> 
> 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
> me know, thank you in advance, here is the code im using:
> 
> <script type="text/javascript">
> $(document).ready(function() {
>     $("a").click(function() {
>         $(this).parents("tr").addClass("highlight");
>     }, function() {
>         $(this).parents("tr").removeClass("highlight");
>     });
> })
> </script>
> 
> <table>
>         <tr>
>             <td> # Goog </td>
>             <td>Google</td>
>             <td>505.08</td>
>             <td>BUY</td>
>         </tr>
>         <tr>
>             <td> # YHOO </td>
>             <td>Yahoo</td>
>             <td>32.10</td>
>             <td>SELL</td>
>         </tr>
>         <tr>
>             <td> # VLO </td>
>             <td>Valero</td>
>             <td>60.95</td>
>             <td>BUY</td>
>         </tr>
> </table>
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jquery-selecting-one-row-on-link-click-tf2942126.html#a8227045
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to