Question

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>System Toolbox</title>
    <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript" />
    <script type="text/javascript">

        $document.ready(function() {

            $("#SearchFor").change(function() {
                    alert($(this).val());
            });
        });

    </script>
</head>
<body>
    <div>
        Search for: <select name="SearchFor" id="SearchFor">
            <option value="company">Company</option>
            <option value="user">User</option>
            <option value="bundle">Bundle</option>
            <option value="course">Course</option>
        </select>
        <div id="SearchType"></div>
    </div>
</body>
</html>

No javascript errors per firebug...

Was it helpful?

Solution

Your document.ready statement is incorrect. Should be:

$(document).ready(function() { 

    ...

});

OTHER TIPS

You wrote

$document.ready(function() {

But should be this instead:

$(document).ready(function() {

Try this instead:

$(function() { //Shortcut for $(document).ready();
   $("#SearchFor").change(function() {
     alert($(this).val());
   });
});

Also, best to use script tags like this still:

<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>

See this question for more detail: Why don’t self-closing script tags work?

should just be

$(function() {
  $("#SearchFor").change(function() {
                alert($(this).val());
        });
    });

$document is not a valid reference to a jQuery object, try

$(document)

Notice the parenthesis

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top