> It's kind of risky to try to observe the blur event from above the > element, because IE has serious trouble with bubbling form inputs. The
Well, it's not that it has *trouble* with bubbling `blur` and `focus` events. It just doesn't do it. ;-) It does, however, bubble its proprietary `focusout` and `focusin` events.[1] That's how some libraries provide support for `blur` and `focus` in their delegation stuff, by using whatever the browser has that works. [1] http://msdn.microsoft.com/en-us/library/ms536936(v=vs.85).aspx FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Apr 4, 7:57 pm, Walter Lee Davis <[email protected]> wrote: > On Apr 4, 2011, at 2:37 PM, Joschi Cassel wrote: > > > Question, Let's say you had a div / table with multiple inputs, do > > you manually set the onblur for each input or "observe" from the > > form, div? > > It's kind of risky to try to observe the blur event from above the > element, because IE has serious trouble with bubbling form inputs. The > Form.Element.Observer and Form.Observer frameworks are there to work > around this problem. Have a look through the documentation. > > If you wanted to do this yourself in an unobtrusive manner, you could > set an observer on each element long-hand, like this: > document.observe('dom:loaded', function(){ > ['field1','field2','field3'].each(function(elm){ > $(elm).observe('blur',function(evt){ > //do your stuff here, > //this == your element, > //evt == the blur event > }); > }); > > }); > > Walter -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
