[jQuery] parent()
[jQuery] parent()
I want to insert a row above an element.
Imagine that I have:
<table>
<tr>
<td><input type="text" id="myElement" /></td>
</tr>
</table>
I want to creat a new structure that looks like this:
<table>
<tr class="errorCell" colspan="100">
<td><span
class="error">Please correct the error</span><br
/></td>
</tr>
<tr>
<td><input type="text" id="myElement" /></td>
</tr>
</table>
However, this produces no visual effect:
$('#myElement').parent('tr')
.before('<tr><td class="errorCell" colspan="100"><span class="error">Please correct the error</span><br /></td></tr>');
If I change the code, I see my new row:
$('#myElement').parent()<span style="font-weight: bold;">.parent()</span>
.before('<tr><td class="errorCell" colspan="100"><span
class="error">Please correct the error</span><br
/></td></tr>');
I don't like this since it's bound to a specific table arrangement.
Does anyone have any hints or different solutions?
Thanks,
Derrek
[Long time lurker, first time poster :)]
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/