I have a dynamic unordered list in my HTML. When I load the file some list items are added in . The format of my is like this when a page is loaded.
<ul class="ui-front">
<li><div>1</div></li>
<li><div>2</div></li>
<li><div>3</div></li>
<li><div>4</div></li>
</ul>
Now I am running a function when the page loads the first child of list item get removed and I am trying to add my custom HTML in the list item. This is my code for it
$('.ui-front').on('DOMNodeInserted', 'li', function(e) {
var arjuna="e.target.firstElementChild.innerHTML";
e.target.removeChild(e.target.childNodes[0]);
$(e.target).append('<hr style="margin-top:7px;margin-bottom:7px">');
});
According to this function when a new list item is inserted then this method calls. But this gives me an error
Uncaught RangeError: Maximum call stack size exceeded
When I remove the function .append. Everything works fine means elements get remove but whenever I add .append it gives me error. Any kind of help would be appreciated