I want to show calender when user click on input field, can some one tell me why thi开发者_如何学编程s script doesn't execute ?
<input type="text" id="dob"/>
here is the script
$("#dob").click(function(){
alert("here");
$("#dob").datepicker();
});
http://jsfiddle.net/zncSh/1/
You need to call $("#dob").datepicker();
when the page loads, not when you click on the input box. When you call .datepicker()
when the page loads, JQuery will automatically assign all the relevant event handlers to the input box to show the picker. So do this in your JQuery instead:
$(document).ready(function(){
$("#dob").datepicker();
});
精彩评论