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

  • SEARCH
  • Home
  • 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 7621211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:08:25+00:00 2026-05-31T04:08:25+00:00

I do a lot of re-rendering templates (adding elements, removing elements) using AJAX. Is

  • 0

I do a lot of re-rendering templates (adding elements, removing elements) using AJAX. Is there an easier way to do this where I could define certain elements ahead of time and pass in a Javascript associative array and it would return the HTML for me? I have heard suggestions for Handlebars, but I heard that it conflicts with Django’s templating system.

An example of this is:

<div id="overlay"></div>

<div id="add-action-box" class="lightbox">
  <a class="close" href="#">X</a>
  <h2>Add Goal</h2>
  <form class="lightbox-form" id="add-action-form">
    <div class="lightbox-form-element">
      <label>Goal</label>
      <input type="text" />
    </div>

    <div class="lightbox-form-element">
      <label>Deadline</label>
      <input type="text" />
    </div>

    <div class="lightbox-form-element">
      <input type="submit" value="Add Goal" />
    </div>
  </form>
</div>

I want to be able to define the above HTML elsewhere and allow Jquery to append the above to another element. I don’t want to type in the above and delete all of the newlines, add \, put quotes around everything, etc. It makes it harder to read.

It is frustrating to edit HTML when it is on the same line like this:

$("body").append('<div id="add-action-box" class="lightbox"><a class="close" href="#">X</a><h2>Add Goal</h2>')
  • 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-31T04:08:27+00:00Added an answer on May 31, 2026 at 4:08 am

    Have you considering using something similar to jQuery Templates. They are no longer maintained and the project has been picked up by jQuery UI. More details can be found here. I usually find them helpful in situations like yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm rendering text using FormattedText , but there does appear to be any way
I read somewhere that when rendering a lot of 3D objects one could merge
Of course, we have been witnessing a lot of browsers differences in rendering elements,
I'm doing heavy computation using the GPU, which involves a lot of render-to-texture operations.
I know there are a lot of questions already posted with arabic language in
I wonder if anyone has found a way to send at mid rendering the
I'm currently doing a project in C# with a lot of rendering, and throughout
Visual Studio 2008 is not rendering right on window resize or maximize. This happens
I would like to render structures like this: <tag1> <tag2 someattribute=somevalue> <.. lot of
I want to be able to define templates once and use them to render

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.