I want to display the datepicker when page loads
$("#dp").datepicker("show")
;
but it is not working.
I want to display the datepicker when page loads
$("#dp").datepicker("show")
;
but it is not working.
Try this:
$(window).load(function(){
$("#dp").datepicker("show");
});
You need to previously have attached the datepicker:
$("#dp").datepicker();
$("#dp").datepicker("show");
Make sure you call the attach function only after the document has finished loading (otherwise you could be trying to attach to a dom element that doesn't yet exist).
$(document).ready(function(){
$('#dp').datepicker('');
});
Also, make sure you have referenced the JQuery library correctly:
<script type="text/javascript" src="jquery.js"></script>
Or try using Microsoft's or Google's CDN-hosted versions:
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>
Or
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>