[jQuery] JQuery Event Fires Before Expected
I'm trying something pretty basic in JQuery (I think).
I want to run a function that will make it so that every Input on the
page will run a function (in this case, alert) whenever the "change"
event happens for that element.
It does work, but for some reason the "test" alert also fires right
when I first run sasBindFormEvents(). Why is this? I only want the
"test" alert when something is typed and then the focus is removed
from the input.
CODE:
================================================
function sasBindFormEvents() {
$('input').change(function () {
alert('test');
})
.change();
}
================================================