Hello,
I have the below function, basically it is running a for loop then states if the first character of the currentsipp=='-' it alert the length. However, as they are in seperate divs, it is not counting the number of times it has found '-' is there anything I can add to this code to make it work, so that it gives me the total number of div's with '-'.
function countdiv(){
var sipps = document.getElementsByTagName("div");
for (i=0; i < sipps.length; i++){
var currentsipp = sipps.getAttribute("id")
if (currentsipp.charAt(0)=='-'){
alert (currentsipp.match(/-/g).length);
}
}
}
I have the below function, basically it is running a for loop then states if the first character of the currentsipp=='-' it alert the length. However, as they are in seperate divs, it is not counting the number of times it has found '-' is there anything I can add to this code to make it work, so that it gives me the total number of div's with '-'.
function countdiv(){
var sipps = document.getElementsByTagName("div");
for (i=0; i < sipps.length; i++){
var currentsipp = sipps.getAttribute("id")
if (currentsipp.charAt(0)=='-'){
alert (currentsipp.match(/-/g).length);
}
}
}