Hi Folks,

I have 2 texboxes with the name names like 'des0' and 'des1', So i need to validate this two controls for required filed with the help of loop. something like this

for (var i=0;i<=1;i++)
{

}

So i have confused what will write inside the loop for validate the controls. So please help me writing the things

Hi folks I got a way to do the same here is the code for that if anyone need this take it its working fine..

function valid()
{
var inputs = document.getElementsByTagName('input'); 

for(var k=0;k<inputs.length;k++)
{
var input = inputs[k]
//if(input.type!= 'text'){ continue };
if(input.value == '')
{
alert("Enter All Fields");
return (false);
}
} 
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.