[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Count number of selected items in dropdown menu

Posted on 2001-07-10
2
Medium Priority
?
1,586 Views
Last Modified: 2008-02-01
I have a dropdown menu that allows multiple selections. I want to count the number of items selected in the menu. How do I do this.
0
Comment
Question by:CUTTHEMUSIC
2 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 100 total points
ID: 6270331
Let's say that you have a form named "form" and your dropdown is called "menuname," then:

Function CountMe()
{
   var i=0;
   var numSelected = 0;

   for (i=0; i<form.menuname.length; i++)
   {
        if(form.menuname[i].selected)
        {
             numSelected = numSelected + 1;
        }
   }
return numSelected
}
0
 
LVL 2

Author Comment

by:CUTTHEMUSIC
ID: 6270360
That was easy
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question