object methods gotcha with DOMAssistant


/ Published in: JavaScript
Save to your folder(s)

*"Only the elements which are are selected through the $ selector will get the extra DOMAssistant methods added to it."


Copy this code and paste it in your HTML
  1. <p id="apple">Apple</p>
  2. <p id="banana">Banana</p>
  3. <p id="cherry">Cherry</p>
  4.  
  5. <script type="text/javascript" charset="utf-8">
  6. // this works
  7. x=$$('banana').addContent('foo');
  8.  
  9. // so does this
  10. y=$(x.next()).addContent('bar');
  11.  
  12. // but this is null, because this object doesn't have any DOMAssistant methods e.g. addContent
  13. z=x.prev().addContent('baz');
  14.  
  15. </script>

URL: http://groups.google.com/group/domassistant/browse_thread/thread/f6dbc459c1116a6a

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.