Mark, After you bind the blur event to the selected fields, you're then triggering the blur event via:
.blur() cheers, Matt Stone On Mon, Dec 13, 2010 at 9:01 AM, Mark McDonnell <[email protected]>wrote: > Hi, > > I was looking at a 'placeholder' fallback script that a colleague of mine > had written (using jQuery as an aid) and I was confused as to why jQuery's > .blur() and .focus() events were being triggered even though the interaction > required is for a user to click in/out of relevant input fields. > > An example of the script is below (it is inserted at the bottom of the > page, so has no need for utilising the DOMContentLoaded event - I mention > this only on the off chance it has any relevance to the cause)... > > jQuery('[placeholder]').focus(function() { alert(1); }).blur(function() { > alert(2); }).blur().parents('form').submit(function() { alert(3); }); > > ...I noticed that '2' would be alerted twice (there are two input fields in > the page with a placeholder attribute). > > Does anyone know why jQuery would cause this behaviour? > > Many thanks. > > Kind regards, > -- > Mark McDonnell > > _______________________________________________ > JSMentors mailing list > [email protected] > http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com > > List Archive: > http://jsmentors.com/pipermail/jsmentors_jsmentors.com/ >
_______________________________________________ JSMentors mailing list [email protected] http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com List Archive: http://jsmentors.com/pipermail/jsmentors_jsmentors.com/
