Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery UI Datepicker setDate() Method

Improve Article
Save Article
  • Last Updated : 08 Jan, 2021
Improve Article
Save Article

jQuery UI datepicker setDate() method is used to set the date from the date field.


$( ".selector" ).datepicker( "setDate" )

Parameters: This method does not accept any parameters.

Return values: This method returns the date.

Approach: First, add jQuery mobile scripts needed for your project.

<script src=””></script>
<script src=””></script>
<link href=”” rel=”stylesheet” type=”text/css” />

Example 1:


<!doctype html>
<html lang = "en">
    <meta charset="utf-8"
    <meta name="viewport" content
        "width=device-width, initial-scale=1"
    <script src
    <script src
    <link href
       rel="stylesheet" type="text/css" /> 
         $(function() {
            $( "#datepicker" ).datepicker();
            $( "#datepicker" ).datepicker("setDate","06/01/21");
      <p>Date: <input type = "text" 
         id = "datepicker"></p>



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!