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>
  5. <script type="text/javascript" charset="utf-8">
  6. // this works
  7. x=$$('banana').addContent('foo');
  9. // so does this
  10. y=$(x.next()).addContent('bar');
  12. // but this is null, because this object doesn't have any DOMAssistant methods e.g. addContent
  13. z=x.prev().addContent('baz');
  15. </script>

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

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.