what about:
$('tr').each(function(){
$('td:first', this).addClass('tomas');
});
dennis.
[EMAIL PROTECTED] wrote:
I've tried the method Mehmet but still no success with this goal
(select every first TD on every TR.
Maybe im doing something wrong, but can someone assure if this code is
in fact correct?
Regards!
On Jun 10, 10:40 am, Mehmet AVSAR <[EMAIL PROTECTED]> wrote:
$("tr").each(function() {
$("TD", $(this)).get(0).addClass("tomas")
});
On Jun 8, 6:40 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
$('tr>td').addClass("tomas");
actually, that willselectall <td> elements that are children of a
<tr> element -- in other words, all <td> elements.
Try this instead:
$('td:first-child').addClass('tomas');
That selects all <td> elements that are thefirstchild of their
parent element.
This works equally well:
$('td:nth-child(1)').addClass('tomas');
* Note: :nth-child(n) is the only "1-based" jQuery selector, since it
is solely based on the CSS pseudo-class, which is also 1-based.
--Karl
_________________
Karl Swedbergwww.englishrules.comwww.learningjquery.com
On Jun 8, 2007, at 12:28 PM, Alexandre Plennevaux wrote:
$('tr>td').addClass("tomas");
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-
[EMAIL PROTECTED] On
Behalf Of jorgeBadaBing
Sent: vendredi 8 juin 2007 16:14
To: jQuery (English)
Subject: [jQuery] Selecting thefirstTDofeveryRow
I have been looking online at the documentation and don't seen to
have any
luck find a way of doing this.
So far I can do this:
$("td:first").addClass("tomas");
Which applies a class to thefirsttdit founds in the table.
How can Iselectthefirsttdforeverytr?
Help will be much appreciated.
Thanks!
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.8.11/838 - Date:
7/06/2007
14:21- Hide quoted text -
- Show quoted text -