On 1/12/06, Matthias Buchetics <[EMAIL PROTECTED]> wrote: > Hi, > I am relatively new to Rails and I can't get the following to work: > what I am trying to do is to make the first item of a list to flash: > > var item = $('items').firstChild; > new Effect.Highlight(item); > > I get the this Javascript error message: > this._base has no child (effects.js, line 445) > > But I am able to do this without any problems: > var item = $('items'); > new Effect.Highlight(item); > (now the whole list flashes) > > My list looks like that: > <ul id="items"> > <li>test1</li> > <li>test2</li> > <li>test3</li> > </ul> > > Thank you very much in advance, > Matthias
Hi Matthias If you're using a Mozilla-based browser, the firstChild call is probably returning an empty text node. Moz inserts these all over the place - you can check with the DOM inspector under the 'Tools' menu. Try using a different method to get at the children; enumerating and checking what type they are might be a way to do it, but it depends on your ultimate goal. Hope that helps! Dave -- Dave Goodlad [EMAIL PROTECTED] or [EMAIL PROTECTED] http://david.goodlad.ca/ _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs