How can I populate multiple tables without copy and pasting code. For instance loop through an array and assign
<p>AMD</p>
without copy and pasting the code below. Maybe looping and incrementing an id written in javascript. I just dont know how to go about it.
<div class="chat-history">
<div class="chat-message clearfix">
<img src="http://lorempixum.com/32/32/people" alt="" width="32" height="32">
<div class="chat-message-content clearfix" onclick=alert("test")>
<span class="chat-time"></span>
<h5></h5>
<p>AMD</p>
</div> <!-- end chat-message-content -->
I tried this im still working on it not fully understanding yet.
<div class="chat">
<div class="chat-history">
<div class="chat-message clearfix">
<img src="http://lorempixum.com/32/32/people" alt="" width="32" height="32">
<div id="company" class="chat-message-content clearfix" onclick=alert("hush")>
<span class="chat-time"></span>
<h5></h5>
<p >DCTH</p>
</div> <!-- end chat-message-content -->
</div> <!-- end chat-message -->
<script>
for (i = 0; i < 10; i++) {
document.getElementById("company").innerHTML+= "<p>TEST</p>"
}
</script>
` tag..something like: `document.getElementById("company").innerHTML+= "
AMD
"`. see if that works. – Abhinay Feb 06 '18 at 05:41