Paul Attuck
Paul Attuck

Reputation: 2269

resize TD in other table dependent for current table

i have two table:

<table class="tab" id="one">
    <tr><td id="resize">aasd as asd asda sd</td><td>a</td></tr>
    <tr><td>a</td><td>a</td></tr>
</table>
<br /> <br />
<table class=tab id="two">
    <tr><td id="resize">a</td><td>a</td></tr>
    <tr><td>a</td><td>a</td></tr>
</table>

.tab td {
    border: solid 1px red;
    height: 20px;
}

i would like - if TD #one #resize is larger of #two #resize then #two #resize = #one #resize.

how can i make this in jQuery?

LIVE EXAMPLE: http://jsfiddle.net/JPJT6/

Upvotes: 0

Views: 418

Answers (2)

asharajay
asharajay

Reputation: 1193

see this hope it is right...

http://jsfiddle.net/JPJT6/3/

Upvotes: 2

Lukas Eder
Lukas Eder

Reputation: 220762

Maybe, you're better off making this a single table, i.e. something along these lines:

<table class="tab" id="one">
    <tr><td id="resize">aasd as asd asda sd</td><td>a</td></tr>
    <tr><td>a</td><td>a</td></tr>

    <!-- A separator row -->
    <tr><td colspan="2"><br /> <br /></td></tr>

    <tr><td id="resize">a</td><td>a</td></tr>
    <tr><td>a</td><td>a</td></tr>
</table>

Of course, you'd have to adapt your CSS as well... But that's probably a lot simpler than tweaking table rendering with jquery.

Upvotes: 1

Related Questions