0

I am trying to utilize Trent Richardson's Date Time Picker (see here).

I am trying to get the selected time when the popup closes, so I am using the following code (in an external .js file):

jQuery(function()
{
    var startDateTextBox = jQuery('#start_date_field');

    startDateTextBox.datetimepicker(
    {
        onClose: function(dateText, inst)
        {
            var testStartDate = startDateTextBox.datetimepicker('getDate');
            alert(testStartDate);
        }
    });
});

However, the alert is coming up saying that the variable is undefined (which also happens when I step through the function). What am I doing wrong?

I opened up Trent's source and I noticed that he is using $ in place of jQuery - I saw elsewhere that you should always use jQuery in WordPress in order to put it into 'no conflict mode' - is that accurate? What are the ramifications of using $ instead of jQuery?

2
  • As for your confusion on what .noConflict() does and is: Have you searched this site (or Stack Overflow or elsewhere) for the topic? See this answer, for instance. Commented Apr 22, 2013 at 9:18
  • 1
    I just tried what do described and it worked for me. Have you checked your source code? Where and how do you enqueue/include the files? The Timepicker itself is working, but it's not giving you the date on close? Can we see the live site? Commented Apr 22, 2013 at 9:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.