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:
var seltags = function (select) {
var nodes = [];
var div = document.getElementsByTagName('div');
var divlen = div.length;
document.write(divlen+nodes[0]+' DIVs. ');
var img = document.getElementsByTagName('img');
var imglen = img.length;
document.write(imglen+nodes[1]+' IMGs. ');
var inp = document.getElementsByTagName('input');
var inplen = inp.length;
document.write(inplen+nodes[2]+' INPUTs. ');
for (var i=0, l=var divlen; i<l, i++){
};
//alert(len);
return nodes;
}
Now I need some guidance on how to proceed on this because im quite confused and lost.. Im not that experienced in JavaScript so im really struggling.. Any help would be much appreciated.
Thank you in advance.