troubleshooting Question

What counts as an element in a form?

Avatar of kadin
kadinFlag for United States of America asked on
JavaScript
5 Comments1 Solution115 ViewsLast Modified:
When javascript counts the number of elements in a form, what counts as an element. That is, what does javascript count?

The number of input elements (<li>) varies from 1 - 5. When I changed the input submit src=image button with the <button> submit button, javascript counted one additional element. How can I get it to count just the elements in the <li>? Thanks.

var length = document.form.elements.length;

<form name="form" method="post" enctype="multipart/form-data" >

 <li>
  <input name="checkbox" type="checkbox" value="'. $i . '"/>
 </li>

<!--<input name="submit_checkbox" type="image" src="/images/submit.jpg"/>-->
<button name="submit_checkbox" type="submit">submit</button>

</form>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros