Remove double bullets in nested list

前端 未结 4 1995
北海茫月
北海茫月 2021-01-18 00:55

Nested list have double bullets. One for the li and another for the child list.

example

    
  • item
4条回答
  •  自闭症患者
    2021-01-18 01:22

    Would you mind if I used styles? Updated

    Code:

            
    • item
    • item
      • item
      • item
      • item
    1. item
    2. item
      1. item
      2. item
      3. item

    Another method might be running through the list of LI and adding the style by detecting child nodes. Example

    Code (HTML is the same):

    var li = document.getElementsByTagName("li");
    
    for (var i=0, max=li.length; i < max; i++)
        if (li[i].childNodes.length > 1)
            li[i].style.listStyle = "none";
    

提交回复
热议问题