Posted By

cczona on 03/18/08


Tagged

javascript DOMAssistant


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

joomla


object methods gotcha with DOMAssistant


 / Published in: JavaScript
 

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

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

  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>

Report this snippet  

You need to login to post a comment.