Ticket #5162 (closed bug: invalid)
Change event binding requires calling the binding function
| Reported by: | zian | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | misc | Version: | 1.3.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
updateChartOfOpenSpots doesn't get called when the value of Month changes in the following code: <script type="text/javascript">
$(document).ready(function() {
$("#Month").val("March"); updateChartOfOpenSpots();
}); $("#Month").change(updateChartOfOpenSpots()); function updateChartOfOpenSpots() {
$("#right").text("Searching for space..."); $("#right").load("../ReserveSpace/ChangeMonth", { month: "March" });
}
</script>
But it does work with: <script type="text/javascript">
$(document).ready(function() {
$("#Month").val("March"); $("#Month").bind("change", updateChartOfOpenSpots()); updateChartOfOpenSpots();
}); function updateChartOfOpenSpots() {
$("#right").text("Searching for space..."); $("#right").load("../ReserveSpace/ChangeMonth", { month: "March" });
}
</script>
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Correction: get rid of the ()s after "updateChartOfOpenSpots" on the line with "bind".