Avatar of Nika Gudge
Nika Gudge
Flag for United States of America asked on

Date picker with javascript

i need a code for datepicker.
JavaScript

Avatar of undefined
Last Comment
dimmergeek

8/22/2022 - Mon
smrocco

You should add jquery.js  and jquery.ui.js (http://jquery.com/)

Then use this code:

html:
<input id="id" class="date-picker" type="text"</inpult>

js:
jQuery(document).ready(function () {
    $('.date-picker').datepicker();
});
mcnute

jsut to specify smrocco's suggestions a full example:

<!DOCTYPE html>
<html>
<head>
    <title>title</title>
    <style type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" ></style>
    <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.9.1/jquery-ui.min.js"></script>
    <script type="text/javascript">
    $(function(){
        $('#datepicker').datepicker();
        });
    </script>
</head>
<body>
    <h1>Datepicker</h1>
    
    <label>Pick a date<input type="text" id="datepicker"/></label>
    
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
dimmergeek

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes