javascript - How can I easily repeat an html element on a page thousands of times? -


How can I replicate an HTML element thousands of times and add everyone to my web page?

For example, suppose I want to display the same word, test , one thousand times on my page. Do I have to type in & lt; P & gt; Trial & lt; / P & gt; is required to write or can I use a javascript function like the following:

 For  (var i = 0; i  

to add web page 1k times test more easily?

Not the best answer. But this is good. Nice and simple way

  & lt; P id = "sample" & gt; & Lt; / P & gt; & Lt; Script type = "text / javascript" & gt; (I = 0; i <1000; i ++) for {document.getElementById ("sample"). InnerHTML + "" & lt; Br> Exam ";} & lt; / script & gt;  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -