Most efficient way to append/remove in jQuery?

I don't think efficiency is a problem here.

I don't think efficiency is a problem here. There are a few things to fix though: .val() only works for form inputs - for divs you want .text(). I presume there's only one div with ID 'load'.

If there are more, a class should be used instead of an ID, and if not, the .each() is not needed. Finally, this is how I would do it: var count = 0, dots = '...'; setInterval(function () { var len = Math. Abs(count++ % 6 - 3); // Gives only 3, 2, 1, 0, 1, 2, 3, ... $('#load').

Text(dots. Substring(0, 3 - len)); }, 500); See a demo here: jsfiddle.net/Xp77Q/3.

Man thats damn cool – benhowdle89 Jan 27 at 10:08.

The way you're doing this is very inefficient because it touches multiple DOM-nodes on every change. It will be more efficient to keep current progress value in a variable and update it with single $('#load'). Html(...) call.

Surely this will defeat the idea of adding/subtracting one at a time – benhowdle89 Jan 27 at 9:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions