Link to home
Start Free TrialLog in
Avatar of SiemensSEN
SiemensSEN

asked on

insert a tr tag using jquery

Hello.
 How do I add a TR tag in a particular section..

e.g
<table id="tbl1">
  <tr id="ca">
  </tr>
  <tr id ="sa">
  </tr>
</table>

I would to add a tr tag after TR with ID = ca and before id = sa

<table id="tbl1">
  <tr id="ca">
  </tr>
<tr id="XX">
  </tr>

 <tr id ="sa">
  </tr>
</table>
Avatar of leakim971
leakim971
Flag of Guadeloupe image

$("<tr id='ca' />").insertBefore("#sa");

Test page : http://jsfiddle.net/unQbh/
Avatar of SiemensSEN
SiemensSEN

ASKER

Sorry..
Here is my TR string to insert
 
str += "<tr>";
                          str +="<td class='tableCell_5percent'> </td>";
                          str +="<td class='tableCell_25percent'> </td>";
                          str +="<td class='tableCell_5percent'> </td>";
                          str +="<td class='tableCell_65percent labels'>"+psets[ps].Name+"</td>";
                          str +="</tr>"

Open in new window


How do I insert it after the row with ID='ca'
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial