views:

1595

answers:

2

I know I must be overlooking something. Here is my code, why is this not working:

    <label>
        Customer</label>
    <%= Html.DropDownList("CustCodes", (SelectList)ViewData["CustCodes"], "-- Select a Customer --", null) %>

<script type="text/javascript">
    $(document).ready(function() {
        $("select#CustCodes").bind("change", gotoDivison);
    });

    function gotoDivision() {
        alert("/ServiceCall/Open");
    }
</script>
A: 

Try this?

<script type="text/javascript">
    $(document).ready(function() {
        $("select#CustCodes").change(
            function () {
                alert("/ServiceCall/Open");
            }
        );
    });
</script>
Conor McDermottroe
That's the same code written a different way.
cdmckay
That should be no different.
cletus
this is technically the same code. i have it working now but not sure why. must have been a js error on the page somewhere that i fixed.
Mike Roosa
+3  A: 

It looks like a simple typo. In the original code you were referencing gotoDivi**so**n in the bind, and the function is called gotoDivi**sio**n.

Julian