Javascript Tooltip / Posts /

how to add datepicker in tooltip

I can't figure out how to add a datepicker (jquery datepicker: to the tooltip.

The way I create the tooltip contents is by concatenating some strings:
    contents += 'test1' + '<input type="text" id="datepicker" >';

The problem is that I need to attach the actual date picker to my input field with id datepicker:


This doesn't work because contents is not part of the DOM.

Any ideas how to overcome this?

Emil  10 years ago   viewed: 10056    

3 Answers

Place your date picker within an element on the page, say:
<div style="display:none">     <div id="dpContainer">test 1<input type="text" id="datepicker" /></div> </div>
Then you can specify how the tooltip will be launched from a target element:
<span class="tooltip" onmouseover="tooltip.pop(this, '#dpContainer')"> Hover me </span>
Let me know if it works or not. Thank you.
Milo   10 years ago
Thanks that kinda worked... the calendar/date picker shows up but if I go to the calendar, the tooltip dissapears. I tried to dynamically change the tooltips properties (while the tooltip was being dispayed) like this
tooltip.changeOptions({ overlay: 1, position: 1 });
but it didn't work. Is it possible to add a repaint() method to the tooltip?
Emil   10 years ago
With what browser you see this issue? IE9?

I saw you want to change options. You can specify the specific option when you define the onmouseover event:
onmouseover="tooltip.pop(this, '#dpContainer', {overlay:true, position:1})"

I am not sure if you specify another option: relativeTo: 'mouse' will fix your issue?
onmouseover="tooltip.pop(this, '#dpContainer', {overlay:true, position:1, relativeTo: 'mouse'})"
milo   10 years ago


Your name*
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: