On one of my pages I used javascript to run through each checkbox element on the page and based on the value attribute it would disable or enable it.
Sort of like this :
- Code: Select all
for(var i=0; i<document.formname.elements.length; i++) {
if(document.formname.elements[i].value == "bluecheckbox") {
if(document.formname.elements[i].disabled == true) {
//enable it
}
}//outer if
}//for
<div>'s can't be accessed in a way similar to my code snippet above.
What javascript code do I use to loop through the <div>'s? I only want to hide the <div>'s that have their id attribute set to a specific set of letter's...how can I do that?
Edited at 3:24 p.m....Reason - Problem Solved! 
I did some googling, then some testing, and arrived at the following code, which takes care of my issue, so here it is for everyone else too!
- Code: Select all
var divs = document.getElementsByTagName('div');
for (var i = 0; i < divs.length; i++){
var divname = divs[i].id;
if(divname.indexOf("sometext") == 0) {
//yes it is, do something
}//if
}//for