Skip to main content

Bug Tracker

Side navigation

#5162 closed bug (invalid)

Opened September 03, 2009 03:36PM UTC

Closed June 13, 2010 05:28PM UTC

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>

Attachments (0)
Change History (2)

Changed September 03, 2009 04:00PM UTC by zian comment:1

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

Changed June 13, 2010 05:28PM UTC by dmethvin comment:2

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.