Tarun
Tarun

Reputation: 267

How to count the number of listbox using javascript

I have an asp page in which the are number of listboxes.I want to count the number of listboxes using Javascript and also there is another requirement,i want to disable all the listboxes in that form

Upvotes: 1

Views: 4697

Answers (2)

Greg
Greg

Reputation: 321786

Using plain javascript:

document.getElementsByTagName('select').length

Using jQuery:

$('select').length

Upvotes: 6

Lucas Jones
Lucas Jones

Reputation: 20203

Using Protoype, you can do this:

$$('select').length

Upvotes: 1

Related Questions