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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:33:30+00:00 2026-06-02T16:33:30+00:00

I keep reading JS books that contain stuff like: function onSuccess(entries) { document.getElementById(loading).innerHTML=; var

  • 0

I keep reading JS books that contain stuff like:

function onSuccess(entries) {
    document.getElementById("loading").innerHTML="";
    var ul = document.getElementById("file-listing");
    for(var index=0;index<entries.length;index++) {
        var li = document.createElement('li');
        li.innerHTML = entries[index].name;
        ul.appendChild(li);
    }
}

However, I read on multiple sites that it’s faster and cleaner to create the whole list in a html = “”, add the ul and li elements and then add the block, append it all in one call… so I am wondering if I should follow the style that I find in many js books or what I read on performance blogs? I am mostly concerned that people reading my code will find it amateurish, if I use the previous code block. Also I have meet a few people that are like, wow all you use is jQuery… instead of using DOM calls like document.getElementById(), etc…

  • 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-06-02T16:33:32+00:00Added an answer on June 2, 2026 at 4:33 pm

    However, I read on multiple sites that it’s faster and cleaner to create the whole list in a html = “”…

    If you mean, someElement.innerHTML = "HTML tags here"; then yes, it’s faster in most cases, because fundamentally parsing and rendering HTML is what browsers do and so they’re very fast at it, whereas if you build things up with DOM calls, there are lots of trips across various layers (JavaScript, DOM, browser internals) each time.

    But: It also doesn’t matter, in most cases. It can matter if you’re rendering a 2,000-row table with lots of columns; but if you’re not doing that it mostly doesn’t matter. You can optimize if and when you see a problem.

    so I am wondering if I should follow the style that I find in many js books or what I read on performance blogs?

    You should do whatever seems cleanest, clearest, and easiest to you.

    I am mostly concerned that people reading my code will find it amateurish, if I use the previous code block.

    That’s their problem. 🙂

    Also I have meet a few people that are like, wow all you use is jQuery… instead of using DOM calls like document.getElementById(), etc…

    There’s nothing wrong with using jQuery for all or nearly all of your DOM manipulations; it’s really good at it, and saves you a lot of time and trouble. You should be familiar with the DOM so you can use it when it’s appropriate (jQuery doesn’t do everything; in particular it’s not good at dealing with text nodes), but that doesn’t mean you shouldn’t use jQuery when and where appropriate.

    Toward that end, some reading:

    • DOM2 Core
    • DOM2 HTML
    • DOM3 Core
    • HTML5 Web Application APIs

    …but again, that doesn’t mean you should use it just because someone looks down on using jQuery. Use tools appropriately. The important thing is understanding the tools you’re using (including jQuery, and also the DOM itself), so you can understand when and where to apply them.

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

Sidebar

Related Questions

I've been reading a couple books/online references about compiler theory, and keep seeing that
Damn, I always feel frustated with CSS. I keep reading books and articles/tuturials but
One of the benefits of ASP.NET MVC I keep reading about is that it's
I keep reading over and over again that one should avoid using singletons for
How do I make it so that the program doesn't keep reading in code
I keep reading everywhere that when you ask for dependencies to be injected in
I keep reading that I have to use svcUtil.exe, crmSvcUtil.exe and company with tons
I've been learning about semantic HTML, and I keep reading how tags like <i>
I keep reading about C99 and C++11 and all these totally sweet things that
I keep reading about people who are test infected, meaning that they don't just

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.