This is really weird. When the clear function is called and resets the value, the Filter change function is then called. The WEIRD part is there is no event BUT any check I do on event like event != NULL or event != 'undefined' or event != void 0 do not work! It blows past the check as if event does exist. If I try to alert the event… it works fine when there is a real click event but when it is called by clear it completely kills the function without doing the alert and without any errors!
$('.clear').live("click", function() {
page.find('.Filter').val("");
});
$('.Filter').live("keyup change", function(event) {
if(event)
alert(event);
else
alert('works');
});
The events for filter are not being called when you click the button, the problem is your change event on filter, change fires when you leave focus of the input box. If your typing in there and then go to click the clear button you’re going to get an alert like clicking clear caused the event to be called but its really your
changeevent being called by leaving focus of the input box, remove the change event.Change your filter events to
$('.Filter').live("keyup", function(event) {