Loading ...
Sorry, an error occurred while loading the content.

Re: replacement for getElementByID

Expand Messages
  • y_lsmith
    ... YAHOO.util.Dom.get( b ); It s common to create an alias to YAHOO.util.Dom, or even to Dom.get to shave verbosity: // wrap in anon function to avoid
    Message 1 of 2 , Aug 1, 2008
    View Source
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "Nick Fox"
      <nicolaspatrickfox@...> wrote:
      >
      >
      > Is there a replacement in the library for getElementByID like in
      > prototype.js. What library is it in if there is?
      >
      > var a = $('b'); // prototype.js
      >
      > for
      >
      > var a = document.getElementByID('b');
      >
      > thanks
      > Nick
      >

      YAHOO.util.Dom.get('b');

      It's common to create an alias to YAHOO.util.Dom, or even to Dom.get
      to shave verbosity:

      // wrap in anon function to avoid poluting the global namespace
      (function () {

      var Dom = YAHOO.util.Dom;

      ...
      var b = Dom.get('b');
      ...

      })();

      Hope this helps,
      Luke
    Your message has been successfully submitted and would be delivered to recipients shortly.