Solved

insert a tr tag using jquery

Posted on 2013-06-26
3
273 Views
Last Modified: 2013-06-26
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>
0
Comment
Question by:SiemensSEN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39279742
$("<tr id='ca' />").insertBefore("#sa");

Test page : http://jsfiddle.net/unQbh/
0
 

Author Comment

by:SiemensSEN
ID: 39279782
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'
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 200 total points
ID: 39279784
$(str).insertBefore("#sa");
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replace link with jQuery 4 25
jquery datable hidden section doesn't submit 2 17
Pass SQL to JSON. Page is in classic ASP and using Jquery 4 37
Glitching Slide Show 19 27
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question