var $datepickerToUseLater = $("<input type='text'
id='whateverYouMayWant' />").datepicker();

...later on...

$("#myHiddenDiv").append($datepickerToUseLater);


Note: there is not period after the dollar sign and datepicker is all
lowercase.

Hth,

Dave





On Oct 30, 2:46 pm, shawn <[email protected]> wrote:
> $.('<div id="datepicker" />').datePicker({}).appendTo
> ("#MyDatePickerTextBox");
>
> I tried the above as you mentioned... it threw an error... not
> supported method/property...
>
> is the syntax at the beginning $.  correct?
>
> I also tried without the dot after the dollar sign... no luck...
>
> I need to be more specific in my description of the goal...
>
> The goal is to dynamically create a text box within a hidden DIV tag.
> That text box then is the element we use to attach the datepicker
> to... the date picker must be attached to it BEFORE the text box is
> officially attached to the DOM anywhere... so the text box element
> object just exists as a javascript object variable until much later in
> the script when we finally DO attach it to the DOM.
>
> Make sense? Please reply.
>
> Shawn
>
> On Oct 30, 8:32 am, Steven Black <[email protected]> wrote:
>
> > $("#datepicker") searches the DOM for this id.  So nothing is coming-
> > back despite having a non-DOM element with this ID.
>
> > This should work: Reference it explicitly.
>
> > $.('<div id="datepicker" />').datePicker(...).appendTo
> > ("#SomeContainer");
>
> > One caveat: I know the datepicker adds other things to the DOM, like a
> > textbox placeholder for example.  I don't know if datepicker assumes
> > the target element is itself in the DOM.  Let us know how this turns
> > out <s>.
>
> > **--**  Steve
>
> > On Oct 30, 3:54 am, shawn <[email protected]> wrote:
>
> > > Hi there,
>
> > > I am trying to add a datepicker to an element that is not yet attached
> > > to the DOM. is this possible?
>
> > > The #datepicker is a text box that is not yet added to the DOM...
>
> > >                 $("#datepicker").datepicker({
> > >                     width: 80,
> > >                     buttonImage: '/images/Web/calendar.gif'
> > >                 });
>
> > > How can I accomplish this?

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to