I have 3 select tags in my page and i wan to set a default value selected for them. I searched a way to do this and it works for one but does not for the other to. i cant find the problem here.
I get the values I want here:

```
String start =String.valueOf(rule.getStart());
String end =String.valueOf(rule.getEnd());
String numberOfCars = String.valueOf(rule.getNumberOfCars());

```

I have tested the values and they are correct.
these are my select tags:

```
<select id="numberOfCars" name="numberOfCars">
            <option value="1">1</option>            
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="1">4</option>            
            <option value="2">5</option>
            <option value="3">6</option>
            <option value="1">7</option>            
            <option value="2">8</option>
            <option value="3">9</option>
            <option value="3">10</option>
        </select>

<select id="startHour" name="startHour">
            <option value="0">0</option>                    
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>   
        </select>
<select id="endHour" name="endHour" >
            <option value="16">16</option>
            <option value="17">17</option>
            <option value="18">18</option>
            <option value="19">19</option>
            <option value="20">20</option>
            <option value="21">21</option>
            <option value="22">22</option>
            <option value="23">23</option>
        </select>

```

and here are the functions that I found. the one for start works perfectly but the other 2 does not and I cant find the reason:

```
<script type="text/javascript"> 
$(document).ready(function() {
  if (!$("#endHour option:selected").length)
$("#endHour option[value='<%=end%>']").attr('selected', 'selected');
});
</script>
<script type="text/javascript"> 
$(document).ready(function() {
 if (!$("#numberOfCars option:selected").length)
$("#numberOfCars option[value='<%=numberOfCars%>']").attr('selected', 'selected');
});
</script>
<script type="text/javascript"> 
$(document).ready(function() {
 if (!$("#starHour option:selected").length)
$("#startHour option[value='<%=start%>']").attr('selected', 'selected');
});
</script>

```