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

Re: How can I use YUI to locate a text input by name and insert a div after it?

Expand Messages
  • lou_tribal
    Try this: var myElement = YAHOO.util.Dom.getElementBy( function(elt){ return (elt.name== some_name );}, input ); If you know an enclosing element you can use
    Message 1 of 2 , May 28, 2009
    • 0 Attachment
      Try this:

      var myElement = YAHOO.util.Dom.getElementBy(
      function(elt){ return (elt.name=="some_name");},
      "input");

      If you know an enclosing element you can use it as a third parameter to the getElementBy method to use it as a boundary for the DOM scan.

      <

      --- In ydn-javascript@yahoogroups.com, "codewrecker" <codewrecker@...> wrote:
      >
      > For example, this doesn't work:
      >
      > <input name="some_name" type="text">
      >
      > <script>
      > var el = new YAHOO.util.Element(document.createElement('div'));
      > var some_element = document.getElementsByName('some_name');
      >
      > // doesn't work .... replacing 'some_element' with 'document.body' works
      > el.appendTo(some_element);
      >
      > </script>
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.