Reputation: 458
Simple question -
When I run the below (really trivial mocked up so I can post here) page in Firefox (haven't tested others) I get a "ready" alert, but I never get a change event from the select element. I've got code on other pages where this seems to work.
I see no errors in firebug or in FF's error console. What am I doing wrong?
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<body>
<select id="SeachFor" name="SearchFor">
<option id="0" value="0" selected="selected">Customer Number</option>
<option id="1" value="1">Email Address</option>
</select>
<script type="text/javascript">
$(document).ready(function () {
alert("ready");
$("#SearchFor").change(function (evt) {
alert("changed");
});
});
</script>
</body>
Upvotes: 2
Views: 103
Reputation: 24236
You've miss-spelt the id in your select tag -
<select id="SeachFor" name="SearchFor">
should be
<select id="SearchFor" name="SearchFor">
Upvotes: 0
Reputation: 103348
Change SeachFor
to SearchFor
, simple typo.
<select id="SearchFor" name="SearchFor">
<option value="0" selected="selected">Customer Number</option>
<option value="1">Email Address</option>
</select>
Upvotes: 4
Reputation: 10548
Iv'e forggoten "r" in the id. SeachFor <> SearchFor.
With "r": http://jsfiddle.net/fkkS9/
Upvotes: 0