<script> /* Title: append * Description: use string concatenate and set innerHTML */ // antipattern // appending inside $.each(reallyLongArray, function (count, item) { var newLI = '<li>' + item + '</li>'; $('#ballers').append(newLI); }); // documentFragment off-DOM var frag = document.createDocumentFragment(); $.each(reallyLongArray, function (count, item) { var newLI = $('<li>' + item + '</li>'); frag.appendChild(newLI[0]); }); $('#ballers')[0].appendChild(frag); // string concatenate and set innerHTML var myhtml = ''; $.each(reallyLongArray, function (count, item) { myhtml += '<li>' + item + '</li>'; }); $('#ballers').html(myhtml); </script>I hope you will enjoy the tips while playing with JavaScript. I would like to have feedbackfrom my blog readers. Your valuable feedback, question, or comments about this articleare always welcome.
IEnumerable "<"invention">" invention = from i in DataContext.invention where i.Sharable == true select i
Friday, 3 January 2014
jquery patterns append
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment