Is the mail list delivery messed up again? On Sun, Dec 12, 2010 at 7:08 PM, Nicholas C. Zakas <[email protected]>wrote:
> I don’t know a lot about jQuery, but if you have two elements with > placeholder, then you’re calling blur() twice – once on each element. So it > makes sense that you’d see “2” twice. > > -Nicholas > > > _____________________________________________________ > Nicholas C. Zakas > Twitter: @slicknet > Blog: http://www.nczonline.net/ > > > *From:* Mark McDonnell <[email protected]> > *Sent:* Sunday, December 12, 2010 2:01 PM > *To:* [email protected] > *Subject:* [JSMentors] jQuery seems to trigger focus/blur events without > user interaction > > 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/ >
_______________________________________________ JSMentors mailing list [email protected] http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com List Archive: http://jsmentors.com/pipermail/jsmentors_jsmentors.com/
