?
Solved

Apply DatePicker to element loaded by innerHTML

Posted on 2009-05-08
1
Medium Priority
?
839 Views
Last Modified: 2012-06-21
I've spend two days on this dilemma so I think I'm missing something fundamental in JS.  

I have a program which loads each individual page into a <div> tag on the parent page using AJAX.  This works great.  

Issue:
I'm trying to use vlaCalendar2.1 for a DatePicker on one of the pages and also need to use the drag and drop feature of scriptaculous to resort items in a list of checkboxes on another page.  Remember, all pages are shown in a <div> tag on the parent page using innerHTML. independently each works fine, but when I put all the <script> tags on the parent document and then try to use these features they have conflicting functions.

What I've tried:
I realize I should get them to work together in case I need them both for the same form, but I wanted to try to load the JS when needed then take it away,  createElement('script').  however, when I append the scripts to the head tag (synchronously -> 1,2,3) they do not apply the datepicker to the Text box.  

Trying this technique on a separate example without the AJAX functionality works.  BUT, in that same example when I try to create another textbox using createElement the datePicker does not apply to the new element even when i rerun the last part of the script:

alert('3');
window.addEvent('domready', function() {
new vlaDatePicker('exampleI', { format: 'm/d/y' }, { prefillDate: {} });
});      


Any ideas on what am I missing here???  Suggestions on a better way to do this?  A good library of JS scripts which contains a nice datePicker and way to sort a list of <div>'s or checkboxes???


thx in advance!
0
Comment
Question by:sixth_street
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 1500 total points
ID: 24342709
> ..  they have conflicting functions.
your need to use unique function names , at least they need to be unique in a namespace
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question