5

How to count <li> in <ul> with vanilla javascript

 3 years ago
source link: https://kriss.io/how-to-count-li-in-ul-with-vanilla-javascript
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
How to count in
  • with vanilla javascript
Posted on January 9th, 2020

I have found long list on Github Readme and want to count all of li tag that on ul tag by start google search found on Stackoverflow

but so many ul in page how that we get right ul tag

the answer is fairy simple too

with using chrome devtools add id

add id to ul

next use chrome devtools console access element by get id then get tag

document.getElementById("list").getElementsByTagName("li");

here simple result screenshot:

count li in ul


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK