Click here to Skip to main content
15,913,758 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<script src="~/Scripts/jquery-1.9.1.js"></script>
       <script src="~/Scripts/jquery-ui.js"></script>
       <link href="~/css/jquery-ui.css" rel="stylesheet" />
       <script type="text/javascript">
           $(document).ready(function () {
               $("#searchFrom").Datepicker();
               // $("#searchTo").datepicker();
               });

       </script>



XML
<div id="sidebar">


        <input type="radio" id="dubai1" title="1" name='city' value='Dubai' checked="checked" />Dubai</br>
        <input type="radio" id="london1" title="2" name='city' value='London' />London</br>
        <input type="radio" id="bangalore1" title="3" name='city' value='Bangalore' />Bangalore</br></br>

            From<input type="date" id="searchFrom" /></br>&nbsp;&nbsp;&nbsp;
            To<input type="date" id="searchTo" /></br>

    </div>
Posted
Comments
dirtyshooter 13-Feb-15 5:05am    
The error that i am getting in console window is "Datepicker() is not a function",
but surprisingly the code is working in normal html file.
Peter Leow 13-Feb-15 5:44am    
Try this:
From<input type="text" id="searchFrom">
Sinisa Hajnal 13-Feb-15 5:58am    
If you're using type="date" from HTML5 spec, you don't have to use jQuery datepicker. Conversely, if you want to use it, you have to have type="text" or leave the type out (default is also text)

HTML
 <html>
<head>   
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.3/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.3/jquery-ui.js"></script>   
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body> 
<p>Date: <input type="text" id="datepicker"></p> 
</body>
</html>

OR

See here :
http://jqueryui.com/datepicker/[^]
 
Share this answer
 
v2
Comments
dirtyshooter 16-Feb-15 6:55am    
thanks anand but this was the first thing i tried. issue is in MVC. the code is perfect for html file.
[no name] 17-Feb-15 3:53am    
Hi abhinav Please check in your mvc layout bundling script are calling properly not?
by comparing some other working layouts at these two places App_Start/BundleConfig.cs and Shared/ layouts.
there was a conflict with jquery loading. just placed jQuery tag on top and the problem was solved. thanks everyone.
 
Share this answer
 

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