Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:44:08+00:00 2026-06-14T15:44:08+00:00

Below is a page code of my custom plugin where I am trying to

  • 0

Below is a page code of my custom plugin where I am trying to use jquery datetime picker.
The picker script was taken from this link. But due to some reason I am getting an Error message saying “jQuery(“#calendar1, #calendar2″).calendar is not a function”. I have checked that the files required are included correctly and before the custom code. But still there is this error.

<?php
function list_my_styles() {  // ADDING THE SCRIPTS
$plugin_url = WP_PLUGIN_URL.'/my_custom_datepicker/';
wp_register_style('my-addon-datepicker-css',$plugin_url.'jquery-calendar.css');
wp_enqueue_style('my-addon-datepicker-css');
wp_enqueue_script('jquery');
wp_register_script('calendar_plugin',$plugin_url.'jquery-calendar.js');
wp_enqueue_script('calendar_plugin');
}
add_action('wp_enqueue_scripts','list_my_styles');

function my_custom_datetime_script() {  // ADDING THE JQUERY SCRIPT
?>
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("#calendar1, #calendar2").calendar();
        jQuery("#calendar1_alert").click(function(){alert(popUpCal.parseDate(jQuery('#calendar1').val()))});
    });
</script>
<?php   
}
add_action('wp_head','my_custom_datetime_script');
function custom_datetime_picker_area() {
?>

<input type="text" id="calendar1" class="calendarFocus"/>
<input type="button" id="calendar1_alert" value="Alert datetime object"/>
<?php   
}
add_shortcode('my_datepicker','custom_datetime_picker_area');
?>

Any Help will be appreciated

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:44:09+00:00Added an answer on June 14, 2026 at 3:44 pm

    This is what I use in my plugin:

            /* add jquery ui datepicker and theme */
            global $wp_scripts;
            wp_enqueue_script('jquery-ui-datepicker');
            $ui = $wp_scripts->query('jquery-ui-core');
            $url = "https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/themes/redmond/jquery.ui.all.css";
            wp_enqueue_style('jquery-ui-redmond', $url, false, $ui->ver);
    

    The CDN I’m using has all of the available themes to choose from as well.

    Then on my form page i use:

            <label for="date_of" style="width: 135px !important;">Presentation Date
            <?php echo '<img src="'.$this->pluginurl.'images/help.png"
            title="Enter the Presentation date here." />';?>
            </label>
            <input type="text" id="date_of" name="date_of" value="" />
    

    and in:

        jQuery(document).ready(function() {
           jQuery('#date_of').datepicker({
              dateFormat: 'yy-mm-dd'
           });
        });
    

    I load plugin.js file with register/enqueue_script which contains the document.ready function.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See code below: I want Page 1 to alert #testing... This works in C
The code below extracts links from a web page and shows them in a
I use below code to post an url to facebook page as a admin
I am trying to use some jQuery functions inside of my php page which
I implemented this code with a wordpress plugin to retrieve a custom field value
I have a python psp page code is shown below. Currently it only prints
I have uploaded a page with the code below to my joomla root directory.
How to change the .page width value below, programmatically in the code behind page?
Below is my code for a simple form in the create_session.php page. I am
The simple code block below can be served up in a static HTML page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.