Link to home
Start Free TrialLog in
Avatar of Nika Gudge
Nika GudgeFlag for United States of America

asked on

Date picker with javascript

i need a code for datepicker.
Avatar of smrocco
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();
});
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
Avatar of dimmergeek
dimmergeek
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial