problem with a .change() event
Hi, I have this page with this single choice select box:
- <select id=DIM_T>
- <option value="HOUR">Hour</option>
- <option value="HOURS3">3 Hours</option>
- <option value="DAY">Day</option>
- <option value="WEEK">Week</option>
- </select>
I want to use this function as an handler:
- var setTimeStepper=function(selectName){
- var selected=$("#"+selectName+" option:selected");
- window.alert(selected.data("step"));
- }
And I call it like this:
- $("#DIM_T").change(setTimeStepper("DIM_T"));
The problem is, the handler gets executed when the page loads (while it should not) and then it's not executed anymore if I try to change the select box value. What did I do wrong?