Having a tough time getting the jQuery Datepicker to fire up
Hi,
I'm trying to use jQuery for the first time here. I have a number of forums (across many pages) that could make great us of the DatePicker tool. So I've tried to take the code examples that I was able to find, and abstract/wrap them up into a DrawDatePicker(elemId) JavaScript function that is in my common/external JS file included in every page.
Here is the the function:
- function DrawDatePicker(id)
- {
- alert("I'm here!");
- if(id == "")
- return;
- $(document).ready(function() {
- $("#" + id).datepicker();
- });
- }
The HTML looks like this:
- <input type="text" id="date-of-birth" onClick="DrawDatePicker('date-of-birth');"/>
So, when the user clicks on a textfield with with an onClick event set to DrawDatePicker(id), it passes its id to the function. I threw the alter in there to make sure the function was in fact getting called, and it does fire the alert with the correct id for each textfield.
Other than that, the only other library, DLL, includes, etc. I make is a reference to the latest version of jQuery:
- <script src="http://code.jquery.com/jquery-latest.js"></script>
I know there aren't any broken file links with my set up, because when I view the source in FF, I can just click on each JS file and it loads the code; if it were a "broken links" issue I wouldn't be able to do that much.
Here's my problem: the date picker doesn't load!
Is anything jumping out as being obviously wrong? Can anybody help out a poor jQuery newbie and shed some light on a situation that has been making him pull out his hair all afternoon?
Thanks!
Z Harvey