I need to assign a style to a table with the class “tableClass”. I have the following markup.
<table border="0" cellpadding="0" cellspacing="0" class="tableClass">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" class="tableClass"> <-- Need to add a style here
<tr class="colheadrowclass">
.. some markup here
</tr>
more markup
<tr id="dataRow" class="datarowclass">
</tr>
</table>
</td>
</tr>
</table>
From the datarowclass, I need to traverse up to the first table with the class tableClass and add a style to it.
This works for me, but I was wondering if there’s a faster way.
$(".datarowclass").parents("table").eq(0).css("hieght", "500px");
The following should help you:
It does exactly what you mentioned:
datarowclassclass.tablewithtableClassclass,Note: You had a typo in the “
height” property (you misspelled it as “hieght“).