Answer the question
In order to leave comments, you need to log in
Why does append not work correctly?
This code doesn't work properly (doesn't output 5 times "lol'")
<div id="render"></div>
var tohandler = $('<div></div>').text('lol'),
container = $('<div></div>').addClass('container');
for(var i = 0; i<5; i++){
container.append(tohandler);
}
$('#render').html(container);
<div id="render"></div>
var container = $('<div></div>').addClass('container');
for(var i = 0; i<5; i++){
container.append("<div>lol</div>");
}
$('#render').html(container);
Answer the question
In order to leave comments, you need to log in
Of course, I have a 2011 home iMac with almost the same specs, except maybe a 2.7 quad-core i5. On it, production has already been done for more than one hundred thousand! And he's not going to retire yet.
The only thing is that if 13 ”is not enough - take a larger external monitor, keyboard and trackpad are also external.
My requirement is 16GB of RAM and an SSD. This one would suit me.
The percentage is weak, for example phpStorm - it will generally be stupid.
On my 13th even Sublime 3 was stupid, or rather not the editor itself - namely the colorhighlighter plugin, when css is 2k lines, then writing some kind of color is hell) Wrote #fff; and wait until the characters appear on the screen, about 1 character in 10 seconds)
Therefore, if you take - only 4 nuclear.
Because the tohandler variable is created once and you run it five times.
You need to create it inside the loop.
var container = $('<div></div>').addClass('container');
for(var i = 0; i<5; i++){
var tohandler = $('<div></div>').text('lol');
container.append(tohandler);
}
$('#render').html(container);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question