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 7056219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:50:29+00:00 2026-05-28T03:50:29+00:00

I wish to use/embed html content (in this case a list <ul> ) at

  • 0

I wish to use/embed html content (in this case a list <ul>) at many places, but declare it only once with in a page.

For example, consider the content:

<ul>
  <li>A</li>
  <li>B</li>
  <li>...</li>
  <li>X</li>
</ul>

Now this content needs to be used at many places like the following:

Use 1:

<div class='left'>
  <ul id='listA'>
    <li>A</li>
    <li>B</li>
    <li>...</li>
    <li>X</li>
  </ul>
</div

Use 2:

<div class='right'>
  <ul id="listX">
    <li>A</li>
    <li>B</li>
    <li>...</li>
    <li>X</li>
  </ul>
</div>

I am sure this can be done in server side or through Ajax calls in client side, but the objective is to optimize/reduce the html content (bytes of data) send across for every page request. So, if that particular content appears in n places in a page, it must be sent only once, then manipulated there to all n distinct places. Thus doing it in server side doesn’t makes sense and Ajax will add the transportation overload, since it is a separate call.

I assume there is nothing in html/css to do so, even iframe cannot be used for this purpose. However I am sure, javascript/jQuery can do so. How?

  • 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-28T03:50:30+00:00Added an answer on May 28, 2026 at 3:50 am

    If the HTML is already on the page somewhere, you can just copy it in jQuery, change what you need to change, and then insert it somewhere else.

    For example, if the only thing on your page is the <ul> you could do this:

    var originalUL = $("ul");
    
    $("body").append($('<div class="left" />').append(originalUL.clone().attr('id', 'listA')));
    
    $("body").append($('<div class="right" />').append(originalUL.clone().attr('id', 'listB')));
    

    Here’s an example:
    http://jsfiddle.net/uU7cV/

    However, if you’re going to be doing this a lot, and the changes to each instance are complex, I’d look into using a Javascript templating system or an Javascript MVC framework like Backbone.js
    http://documentcloud.github.com/backbone/

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

Sidebar

Related Questions

I wish to use Wikipedia api to extract the result of this page: http://en.wikipedia.org/wiki/Special:PrefixIndex
I wish to use the $html->image(...) helper function in CakePHP to output images, but
I wish to use xml and xsl to generate controls on an asp.net page.
I wish to use the Translator classes of Zend framework in my app, but
I have two stored procedures I wish to use in my stored procedure, but
I'm developing an app and I wish use the UIImagePickerController but I wish let
I wish to use a join across some tables but am having some difficulty
I wish to use QtWebKit to load a url for display, but, that's the
I wish to use the following regex for validating a file-upload: /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(ext)$/ But
I wish to use the my Microsoft Outlook Task list in my C# application.

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.