开发者

Why date picker does not appear?

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();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜