Bug Tracker

Modify

Ticket #5162 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

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

comment:1 Changed 4 years ago by zian

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

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to misc

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

For more help ask in the forum.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.