By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,544 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

select all elements of one selection list

P: n/a
hello I'm french so I hope I hunderstand your answers ! I'm begginer
in javascript and I would like to do this :

select all elements of one selection list (html) with a javascript
fonction

could you help me ?

thanks lot !
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gs****@mageos.com (GiSmo) writes:
hello I'm french so I hope I hunderstand your answers ! I'm begginer
in javascript and I would like to do this :

select all elements of one selection list (html) with a javascript
fonction


It requres the select element to accept multiple selected options
(e.g., the tag contains the "multiple" attribute).

Assume "selectRef" refers to the select element:

for (var i=0;i<selectRef.options.length;i++) {
selectRef.options[i].selected = true;
}

That is, set the "selected" field of each option to "true".

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
Thx lot it work !

at a next time
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.