need some help here. I am using bootstrap CSS for designing my website.
This is my first code snippet:
<ul class="nav nav-pills nav-stacked border-right" id="clearFilter" style="display:none">
<li class="text-uppercase bold-text" onclick="showChild(event)"><a href="#" class="li-head-color">Clear Filter<span class="glyphicon glyphicon-plus float-right" aria-hidden="true"></a></li>
</ul>
If I check the length of this ul element. It shows 3. Where are there is only 1 li inside the ul.
Then when I try to add a li to this ul using javascript, the length is increased by just 1.
This is the javascript code:
var ul = document.getElementById("clearFilter");
var li = document.createElement("li");
var anchor = document.createElement("a");
var span = document.createElement("span");
span.setAttribute("class","glyphicon glyphicon-remove-circle float-right");
anchor.appendChild(document.createTextNode(str));
anchor.appendChild(span);
anchor.setAttribute("href","#");
li.appendChild(anchor);
li.setAttribute("onclick","removeFilter(event)");
li.setAttribute("style","display:none");
ul.appendChild(li);
So what might be the reason for this. I have 3 more such ul element in my code. The length of the ul is greater than the li elements actually present. What might be the reason for this? Am I doing something wrong here?
<span>element has no closing tag