Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am using datepicker and when i click on textbox not working

HTML
<!--calendar-->

 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
 <script src="//code.jquery.com/jquery-1.10.2.js"></script>
 <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
 <link rel="stylesheet" href="/resources/demos/style.css">


JavaScript
 <script type="text/javascript">
$(function() {
  $( "#dob" ).datepicker({
    changeMonth: true,
    changeYear: true
  });
});
</script>


HTML
<input type="text" class="contacttxt" id="dob" name="dob"  placeholder="YYYY/MM/DD" value="" size="10" >
Posted
Updated 11-Dec-15 5:03am
v2

1 solution

Perfectly works - [Demo] DatePicker ChangeMonth and ChangeYear Example[^].

Even I added the same code which you have added here and tested as a HTML. It is working. HTML is like below.
HTML
<html> 
<head>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">

    <script type="text/javascript">
        $(function() {
            $( "#dob" ).datepicker({
                changeMonth: true,
                changeYear: true
            });
        });
    </script>
</head>
<body>
    <input type="text" id="dob" />
</body>
</html>
 
Share this answer
 
Comments
Harsh Kumar 11-Dec-15 9:52am    
not working
error @ console

TypeError: $(...).datepicker is not a function
<anonymous>
contact-us.php:51
jQuery.Callbacks/fire()
jquery-1.10.2.js:3048
jQuery.Callbacks/self.fireWith()
jquery-1.10.2.js:3160
.ready()
jquery-1.10.2.js:433
completed()

and

ReferenceError: SyntaxHighlighter is not defined
<anonymous>
contact-us.php:184
m.Callbacks/j()
jquery.min.js:2
m.Callbacks/k.fireWith()
jquery.min.js:2
.ready()
jquery.min.js:2
J()
Did you test the html I provided? It is working.
Harsh Kumar 11-Dec-15 10:23am    
independently code works but in my project file it not working
Then you have some other issue. Check on console if the jQuery files are included or not?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900