test 1 test 2 test 3 test 4 test 5 test 6 test 7 test 8 test 9 test 10 test 11 test 1..." />
This could do the trick: select id="select" multiple="multiple"> test 1 test 2 test 3 test 4 test 5 test 6 test 7 test 8 test 9 test 10 test 11 test 12 Attr('selected', 'selected'); } }) Without jQuery: window. Onload = function(){ var indexes = 1,3,4,5,9,12; var options = document. GetElementById('select').
Options; for(i=0; i.
This could do the trick: test 1 test 2 test 3 test 4 test 5 test 6 test 7 test 8 test 9 test 10 test 11 test 12 Javascript (jQuery): indexes = 1,3,4,5,9,12 $(document). Ready(function(){ for(i=0; iAttr('selected', 'selected'); } }); Without jQuery: window. Onload = function(){ var indexes = 1,3,4,5,9,12; var options = document.
GetElementById('select'). Options; for(i=0; iSelected = true; } }.
– Ryan Feb 1 '10 at 20:20 it shouldn't make a great deal of difference with or without jQuery. – Ty W Feb 1 '10 at 20:42.
The jquery select plugin has a selectOptions(value, clear) method which selects multiple values in a select box. But it takes the values as parameter instead of indexes.
You'd be better off setting classes on the option elements and addressing them that way, rather than by index: Twix Mounds Milky Way And then: $("option. Caramel", "#my-select"). Each(function () { this.
Selected = true }); Edit: But if you really want to do it by index, you could do: function selectOptionsByIndex(select, indexes) { var I = 0; select.children(). Each(function (j) { if (indexesi == j) { ++i; this. Selected = true } }); } selectOptionsByIndex($("#my-select"), 1, 3, 4, 5, 9, 12 ); (This depends on the list of supplied indexes being in ascending order.).
Yes I thought about that, having the list items be aware of what group they are in, but this could get unruly quickly when the reasons they are group extend beyond their own properties, like 'most popular' candy group, or what if they fall into both the chocolate and the caramel group for example. – Ryan Feb 1 '10 at 20:19 You could say . The selector "option.
Caramel" would find elements that have the class "caramel", even if they also have other classes. – Sean Feb 1 '10 at 20:36.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.