How to get child element by class name? January 25, 2022 by admin Use doc.childNodes to iterate through each span, and then filter the one whose className equals 4: