Bug Tracker

Opened 10 years ago

Closed 9 years ago

#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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 10 years ago by zian

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

comment:2 Changed 9 years ago by dmethvin

Component: unfiledmisc
Resolution: invalid
Status: newclosed

You're calling the function in the bind() rather than passing the function object.

For more help ask in the forum.

Note: See TracTickets for help on using tickets.