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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -