Reputation: 10117
Im trying to call a function when the value of any form value changes.
This is my code:
function reload()
{
tmp = findSWF("chart");
x = tmp.reload("chart.php", false);
}
function findSWF(movieName) {
if (navigator.appName.indexOf("Microsoft")!= -1) {
return window["ie_" + movieName];
} else {
return document[movieName];
}
}
$(".formclass").change(function() {
reload();
});
If i make a link with an onclick
action, it works, but using the last .change
action, nothing happens.
Ideally, i could also pass the name and value of what has changed to that url
Upvotes: 0
Views: 177
Reputation: 6124
the change event only kicks in when you changed the value AND the control loses focus for text controls:
The change event is sent to an element when its value changes. This event is limited to elements, boxes and elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.
if you want to trigger the function as the user types in the control, try keydown() or keypress()
Upvotes: 5