Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
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. – Johannes Pille Apr 22 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? – t f Apr 22 at 9:21

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.