I want to append some data after an element in my markup for which I am using after() method. My json is as below (in a separate file)-
The problem is, it reverses the order of items and display them as 3 2 1 instead of 1 2 3! Can anyone please help me understand why and how can I fix this?
const data = [{
  "testData": {
    "one": "1",
    "two": "2",
    "three": "three"
  }
}]
const json = data[0].testData;
for (const key in json) {
  var listItem = `<div><p>${key}</p><p>${json[key]}</p></div>`;
  $("hr").after(listItem);
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h2>SAMPLE</h2>
<hr> 
     
    
and the markup will render as
.I want the structure to look like
. If I prepend() then the order works properly. I don't understand this behavior. – HarshVardhan Bandta Sep 22 '20 at 17:57