Avatar of Babak Sekandari
Babak Sekandari
Flag for United States of America asked on

Help Understanding JQuery DatePicker

I need help understanding the JQuery DatePicker widget examples here:


First of all, in JQuery, what's the difference between




I understand,

$(".xxx") selects elements with class xxx

$("#xxx") will select an element with id xxx

$(button) selects button elements 

But I don't understand, $.

The explanation here made no sense to me:


In the examples on the JQuery datepicker tutorial, what is this:


What is this:

$( ".selector" ). 

Is it saying that some element with the class, "selector" has a datepicker object in it?

But then, when I try this, it only shows the input element:

<div><input class="test">
$( ".test" ).datepicker("show")

Open in new window

Even though this works:

$( ".test" ).hide();

That's from the show() example in:


How would code like:

$( ".selector" ).datepicker( "show" );
// and
$.datepicker.parseDate( "yy-mm-dd", "2007-01-26" )

Open in new window

work in a full example like in this context:

<div id="datepicker"></div>
$( "#datepicker" ).datepicker();

Open in new window

thanks in advance


Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
Michel Plungjan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Babak Sekandari

Very helpful.
Thanks you.

But in the datepicker documentation, what is $( ".selector" )
For example, is
$( ".selector" ).datepicker( "show" );
an abstract way of showing something like,
$( "myDateDiv" ).datepicker( "show" );

Because when I try it, this works:
$( "#myDateDiv" ).datepicker();

But this does nothing:
$( "#myDateDiv" ).datepicker("show");


First, I would recommend to use a better date picker as the one you use is very limited.

You will save a lot of time using using one of these datepicker

I'm using
Demo https://uxsolutions.github.io/bootstrap-datepicker/

or if you need the date & time

Michel Plungjan


$( ".myDateDiv" ).datepicker( "show" );

would change a text input field with class=myDateDiv into a datepicker
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy