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

Re: [ydn-javascript] How to fill an input box

Expand Messages
  • Adeola Awoyemi
    ... I ve seen both used but to be consistent (when using YUI) its better to use the YUI method. You could even create a reference to it by doing: var YUD =
    Message 1 of 4 , Oct 3, 2007
      Mario Daniel Carugno wrote:
      > > I tend to give even input fields an id attribute so that I can access
      > > them easily:
      > >
      > > <input type="text" name="the_name" id="the_name"/>
      > >
      > > Then set the value in javascript:
      > >
      > > document.getElementById('the_name').value = 'default value';
      > >
      > > Or using YUI:
      > >
      > > var the_name = YAHOO.util.Dom.get('the_name');
      > > the_name.value = 'default value';
      >
      > Thank you !
      > I've discovered the first method by myself.
      > Is the YUI method better or recommended ?

      I've seen both used but to be consistent (when using YUI) its better to
      use the YUI method. You could even create a reference to it by doing:

      var YUD = YAHOO.util.Dom;

      So you can then just use `YUD.get('the_name')` wherever in your code.
      Just saves you typing more characters.

      Adeola.
    Your message has been successfully submitted and would be delivered to recipients shortly.