I have a drop down list:
@Html.DropDownList("CharacterID")
and the following jQuery:
$(document).ready(function(){
$("#CharacterID").on(change, "#CharacterID", (function () {
alert("I've Changed");
//var id = $('#CharacterID').val();
}));
});
which is not firing when I change one of the dropdown selections.
What can I do to fix this? I've looked at similar questions and answers and tried incorporating those but they haven't worked.
Here's what happens when I try running it in JSFiddle: http://jsfiddle.net/vgMdF/
Two problems:
change
is a string, not a magic variable. Add the quotations around it.$(document).on()
..
$(document).ready(function(){
$(document).on("change", "#CharacterID", (function () {
alert("I've Changed");
//var id = $('#CharacterID').val();
}));
});
You can see this working here: http://jsfiddle.net/h3q5d/
With your full page, and jquery loaded - it also works: http://jsfiddle.net/vgMdF/1/