![]() |
JS selector engine - array issue
Hello All,
I am trying to build a small selector engine in order to detect the number of specific html tags, but I am having trouble in storing the number of the found tags in an array and afterwards printing them in the html.. Can someone please help me out? You can find the code below. Code:
Thank you in advance. |
And what is your exact idea behind designing a new "Selector Engine" that too without experienced in JavaScript ??
|
Experience kind Sir.
|
Well, I appreciate your affort. But the thing is without having proper knowledge of any programming language, you can't just start implementing your idea.
I would prefer you to start understanding the basics first, and then come with a clear picture of what your exact problem is. Lets investigate what you have provided - 1) you defined a variable nodes as an array. 2) then you are trying to access nodes[0], nodes[1], and nodes[2] that too variable nodes without any values stored. 3) the problem in your for loop syntax (as highlighted in red)- for (var i=0, l=var divlen; i<l, i++){ } It should be for(var i = 0, l = divlen; i < l; i++) { } 4) No semicolon ( ; ) after end of for loop 5) The argument select passed in the function is never used, and the function is returning the empty array nodes. so, logically, there is no use of this function. |
| All times are GMT +1. The time now is 09:50 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.