Thanks, it seems there are many ways to achieve the same goal. I have changed
the code to use 'hover' and I will  look into x-path syntax.




Tim Gossett-2 wrote:
> 
> On 2/12/07, Rigent <[EMAIL PROTECTED]> wrote:
>> I have a table displaying data and use the following script to create a
>> highlight on a row, except for the first row (.headingrow) because it's
>> used
>> as the header for the table.
> <snip>
>> would there be a more efficient way to do
>> this, without having to add the class to the first row of the table?
> 
> Use hover() in one line of script instead of mouseOver and mouseOut on
> two:
> 
> $("#docstable").find("tr").not(".headingrow").hover(
>       function(){ $(this).addClass("trover"); }, // executes onMouseOver
>       function(){ $(this).removeClass("trover"); } // executes onMouseOut
> );
> 
>>  Since it may not always be possible to apply a class to that row.
> 
> Try XPath.
> 
> $("#docstable tr").not("tr:first-child").hover(
>       function(){ $(this).addClass("trover"); }, // executes onMouseOver
>       function(){ $(this).removeClass("trover"); } // executes onMouseOut
> );
> 
> I prefer XPath when selecting elements, and classes when applying styling.
> 
>> I imagine there is a way to search for; all the siblings of the first row
>> but not that row itself,
> 
> $("tr").not("tr:first-child")
> 
>> or to search for all TRs that have TDs as children.
> 
> $("tr td").parent()
> 
> Or more generally:
> 
> $("td").parents().find("tr")
> 
> The latter example does not require the td to be a direct child of the tr.
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Selecting-all-other-siblings-tf3215034.html#a8928988
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to