Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i count how many text boxes have text in them

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
if i have four text boxes on a page how can i tell how many of them have text within them
 
function checkForm(x)
{
var count = 0;
for(var i = 0; i < x.elements; i++)
{
if(!/^\s*$/g.test(xelements.value))
{
count++;
}
}
return count;
}

then call the function like so:

var howmany = checkForm(document.formname); luciddream@subdimension.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top