Question: I want to create loop in select box. But I want one code for different select.
I am able create for one select but I want for multiple .

for single: [with id](http://jsfiddle.net/rlemon/5J29g/) 

I want to change this code according class or for multiple select.
My code for this:

```
<select class="foo"></select><select class="foo"></select>

```

and:

```
$(document).ready(function() {
    var elm = document.getElementByClass('foo'),
    df = document.createDocumentFragment();
    for (var i = 0; i <= 60; i++) {
        var option = document.createElement('option');
        option.value = i;
        option.appendChild(document.createTextNode(" " + i));
        df.appendChild(option);
    }
    elm.appendChild(df);
});

```

Answer: 
I think what you want is 

```
document.getElementsByClassName('foo');

```

<http://jsfiddle.net/5J29g/48/>
I just updated your jsfiddle adding this:

```
(function() {
var foos=document.querySelectorAll(".foo");
for(var j=0;j<foos.length;j++){
    var elm = foos[j],
        df = document.createDocumentFragment();
        for (var i = 1; i <= 42; i++) {
            var option = document.createElement('option');
            option.value = i;
            option.appendChild(document.createTextNode("option #" + i));
            df.appendChild(option);
        }
        elm.appendChild(df);
    }  
}());

```

sample check that out, [DEMO](http://jsfiddle.net/5J29g/49/)