javascript - Any way to get nearby html nodes different from current node's tag name in NodeJS? -
let's have following html code..
<html> <head></head> <body> <div> <input type ="text"> <img src = "pic.jpg"> <a href ="index.html">home</a> </div> </body> </html>
and want @ nodes around element that's on same level. example, above html code, possible like...
$("input").returnnodesonsamelevel()
and can return list of nodes here contain [< input...>, < a...> ] ?
i'm using nodejs's request module grab page source , using cheerio parsing. sibling() returns nodes of same tag name makes sense. if there's better module or way this, please let me know.
thank you.
if $("input").siblings()
doesn't work, try: $("input").parent().children()
Comments
Post a Comment