Tuesday, November 13, 2012

Create node list from a single node in JavaScript

This is one of those it seems so simple, but I cannot come up with a good way to go about it.


I have a node, maybe nodelist = document.getElementById(\"mydiv\"); – I need to normalize this to a node list. And not an array either: an actual, bona-fide nodeList object.


Not nodelist = [document.getElementById(\"mydiv\")];


No libraries, please.






Rating: 3 out of 5 based on 3 ratings



The post Create node list from a single node in JavaScript appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/create-node-list-from-a-single-node-in-javascript.html

No comments:

Post a Comment