...

View Full Version : walking the dom



emehrkay
01-03-2006, 10:35 PM
i have a div that has a table with form fields in it. i want to single out those fields and loop through them and validate their values. how would i do that?

document.getElementsByTagName would work, its just that it would pull every element with that tagname, i just want the ones in that div, and im only checking to see if they're blank.

thanks

example:
<div id="container">
<form>
<input id="nameField">
<input id="siteField">

emehrkay
01-03-2006, 10:55 PM
got it




function validatex(){
var dom = document.getElementById('shout_form');
var dom2 = dom.getElementsByTagName('input');
for(var i = 0; i < dom2.length; i++){
alert(dom2[i].id);
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum