debussy007
2010-03-02 15:20:00 UTC
Hi,
I would like to have the previous TD element with class "time".
I tried : $(this).closest('td').prev('td.time').html() (where "this" is a
div element inside a TD)
But it only works for a div inside a TD that is *directly* following the
td.time element.
See the code below: my jquery selector above is only working for the div's
inside <td class="lun01032010"> (where the latter is directly following
td.time element),
not for the div's inside <td class="mar02032010">
<td class="time">
8am
</td>
<td class="lun01032010">
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
</td>
<td class="mar02032010">
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
</td>
Thank you for any help.
мэтт
I would like to have the previous TD element with class "time".
I tried : $(this).closest('td').prev('td.time').html() (where "this" is a
div element inside a TD)
But it only works for a div inside a TD that is *directly* following the
td.time element.
See the code below: my jquery selector above is only working for the div's
inside <td class="lun01032010"> (where the latter is directly following
td.time element),
not for the div's inside <td class="mar02032010">
<td class="time">
8am
</td>
<td class="lun01032010">
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
<div class="quarter daylun"> </div>
</td>
<td class="mar02032010">
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
<div class="quarter daymar"> </div>
</td>
Thank you for any help.
мэтт
--
View this message in context: http://old.nabble.com/Get-the-previous-element-matching-a-class-tp27757091s27240p27757091.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
View this message in context: http://old.nabble.com/Get-the-previous-element-matching-a-class-tp27757091s27240p27757091.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.