Hi
The following produces different results on Firefox and IE7, any idea
why?
HTML:
<input name="test" type="text"
onchange="dosomething(this)" />
<div>nothing special</div>
JS:
function dosomething(element) {
   var test = element.next(''div'');
}
With Firefox it works as supposed, test contains the DIV. On IE7,
however, the line inside the function throws a "Object does not
support method" error.
Thanks for your wisdom and patience!
-sven
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Sven wrote:> Hi > > The following produces different results on Firefox and IE7, any idea > why? > > HTML: > <input name="test" type="text" onchange="dosomething(this)" /> > <div>nothing special</div> > > JS: > function dosomething(element) { > var test = element.next(''div''); > } > > With Firefox it works as supposed, test contains the DIV. On IE7, > however, the line inside the function throws a "Object does not > support method" error. > > Thanks for your wisdom and patience! > -sven > >IE requires you to extend each element at least once. So change your dosomething function to: function dosomething(element) { var test = $(element).next(''div''); } - Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yep, I''ve just figured it out myself :-) It even works to put this... element = $(element) May save some cycles when element is used more than once inside the function. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Still, thanks for the hint, Ken! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---