I'm trying to bind all input fields on a 'form page' to the blur event in jquery. If I put a breakpoint in the each it gets paused so I think the code is being called on page load properly and the loop is working okay. I think the syntax is correct for binding the event as well ? I am not getting the alert when I do anything (leave!) any of the fields in my form though so I think something about this is wrong ? Can anyone point it out to me ?
//for each item in the form (:input "selects all input, textarea, select and button elements.")
$(' :input').each(function () {
$('this').bind('blur', function(){
alert ("nasty, shoudl be a log!");
myfunction();
})
})
$(':input').on('blur', function() { // DO THINGS });.each