Raja
Raja

Reputation: 219

Using Jquery selector to select the child of div

I have use the two different table with same class Name and placed with in the different div like below code snippet.

Code snippet:

 <div>
    <div class="gridheader scrollcss">
        <div>
            <table class="table" style="position: relative;" cellspacing="0">
                <colgroup>
                    <col style="width: 160px;">
                    <col style="width: 160px;">
                    <col style="width: 160px;">
                    <col style="width: 160px;">
                    <col style="width: 160px;">
                </colgroup>
                <thead>
                    <tr class="columnheader" style="cursor: pointer;">
                        <th class="headercell"><div class="headercelldiv">Taskname</div></th>
                        <th class="headercell"><div class="headercelldiv">Starttime</div></th>
                        <th class="headercell"><div class="headercelldiv">Endtime</div></th>
                        <th class="headercell"><div class="headercelldiv">Duration</div></th>
                        <th class="headercell"><div class="headercelldiv">Status</div></th>
                    </tr>
                </thead>
                <tbody class="hide">
                    <tr><td></td><td></td><td></td><td></td><td></td></tr>
                </tbody>
            </table>
        </div>
    </div>

<div class="gridcontent" style="height: 462px; overflow: auto;">
    <div class="gridcontainer" style="height: 420000px;">
        <table class="table" style="position: relative;" cellspacing="0">
            <colgroup>
                <col style="width: 160px;">
                <col style="width: 160px;">
                <col style="width: 160px;">
                <col style="width: 160px;">
                <col style="width: 160px;">
            </colgroup>
            <tbody>
                <tr><td class="rowcell">1</td><td class="rowcell">01/01/2013</td><td class="rowcell">01/05/2013</td><td class="rowcell">0 days</td><td class="rowcell">2</td></tr>
            </tbody>
        </table>
    </div>
  </div>
</div>

How to use the jquery selector to select the second table place with in the gridcontainer div and apply the style for this table only

Upvotes: 1

Views: 463

Answers (3)

Just code
Just code

Reputation: 13801

$('.gridcontainer table').css('style attribute','its values');

Fiddle Example

Upvotes: 0

megawac
megawac

Reputation: 11353

To select the second table you can use .eq():

var secondGridTable = $('.gridcontainer:eq(1)').find("table")

Upvotes: 0

Arun P Johny
Arun P Johny

Reputation: 388316

$('.gridcontainer table').css(/*your styles*/);

Upvotes: 1

Related Questions