Monday, 15 June 2015

prototypejs - prototype newbie, Element.identify(element) vs Element#(identify) -


I have the following in my code and want to add them to droppubs, using Droppables.add, which means Is that I need the ID of each of the elements

   

Reading my prototype documentation is that the following should be interchangeable and both should return the 'sewing 1' string:

  $ ('seating1') .  

and

  element. Identity ($ ('seating1'))  

I've reduced what I really do, because I can clearly just droppables.add ('seating1') . What I'm actually doing is $ $ ('.Unbooked') and then by identifying the elements in finding the ID but only the second form works. I like to use the first form because it is more friendly.

When I run it from the Firebug console, the first form returns the function. The second form expects me to 'seating 1'

What am I missing?

As always, any help or insight is appreciated.

Thanks, Hubert

should be:

 < Code> $ ('seating1'). Identity ()  

Therefore, the complete code will be something like this:

  $$ ('unbooked'). Each (function (L) {$ (L). ID (); // or even ... $ (L) .ID;});  

No comments:

Post a Comment