Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:41:54+00:00 2026-05-23T08:41:54+00:00

Is it possible to append html before and after a JQuery.tmpl ? I would

  • 0

Is it possible to append html before and after a JQuery.tmpl?

I would like to insert a nested table in

<table id="accTable">
  <tr class="row" id="12345">
  </tr>
  <!-- New row to be inserted here -->
</table>

so I have done

var dat = [];
$.each(result, function(key, value){
    dat.push({
    FROM: this.date,
    ID: key,
    });
});

var markup = "<tr> <td>${ID}</td> <td>${FROM}</td> </tr>";

$.template("actTemplate", markup);

$('#'+id).tmpl("actTemplate", dat).after('#'+id);

But somehow I need to append <tr><td><table> and prepend </table></td></tr>.

I have thought about adding that HTML to the existing, but it should happen in a button press, so until it is pressed would it look wrong. So I guess the append and prepend have to happen when the template is inserted…?

Any suggestions on how to solve this?

Update

In this jsFiffle will a row be added/removed when “Details” is clicked. This is the row that I would like to replace.

http://jsfiddle.net/littlesandra88/hhMM6/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:41:55+00:00Added an answer on May 23, 2026 at 8:41 am

    You can make it this way:

    EDITED
    
    var wrapper = $( '<tr id="details"><td><table></table></td></tr>' );
    var wrapperTable = wrapper.find( 'table' );
    $.tmpl ("actTemplate", dat ).appendTo( wrapperTable  );
    
    wrapper.insertAfter( '#'+id );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible using jQuery to create an <iframe> element and append html content
is it possible to do an append without specifying a selector so in html
If you use append() to insert a new DOM node, is it possible to
Is it possible to clear the contents of a html select object using JQuery?
I would say if it's possible to add wysiwyg editor (CKeditor) in HTML pyrocms
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
var objs = new Array(); function Foo(a) { this.a = a $(#test).append($(<button></button>).html(click).click(this.bar)); } Foo.prototype.bar
I am trying to load HTML via JQuery, using the .load function. This is
Is it possible to use jQuery to access the contents of an iframe when
I have an html file that I'd like to open and read from, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.