Seems like this should be straightforward based on the documentation:

...
<select id="mySelect">
        <option value="0" selected="selected">whatever</option>
        <option value="1">other whatever</option>
</select>
...
<script>
$(document).ready(function(){
        alert($("#mySelect").index($("option[value=1]")));
});
</script>

ought to alert "1" - right?  Instead I get "-1".

If I change "#mySelect" in the <script> block to "*", I get "16", the
true index of the option among all the elements of the page.  But I'm
wanting to find the index of the option element within the select
element.

Thanks to anyone who can help!  SA

Reply via email to