Try the following:

<script type="text/javascript" src="/shared-scripts/
jquery-1.2.1.min.js"></script>

<script type="text/javascript">
        $(function() {

                $("#debug").click(function() {

                        $("#mySelect option").each(function(i) {

                                if (this.selected) {
                                        alert($(this).attr("value") + ":" + 
$(this).text() + " was
selected");
                                }

                        });

                        return false;

                });

        });
</script>

<select id="mySelect">
        <option value="A">a</option>
        <option value="B">b</option>
        <option value="C">c</option>
</select>

<button id="debug">Debug</button>

Clicking on Debug will loop over the options and alert the selected
one.

Adrian

BuckRogers wrote:
> How do you return the index of an option selected:
>
> <select>
> <option value="A">a</option><option value="B">b</option><option
> value="C">c</option>
> </select>
>
>
> I want to return 0, 1 and 2 when the above optiones are selected

Reply via email to