开发者

jQuery datepicker button in mvc project

I need to create a datepicker and the simplest thing doesn't work:

In my view :

@model SomeModel
<script type="text/javascript">
alert("works");
$(function () {
    $("#datepicker").datepicker({
        showOn: "button",
        buttonImage: "/SiteContent/images/Brand/icon_calendar.png",
        buttonImageOnly: true
    });
});
</script>

<div>
    <input name="input2" type="text" size="20" class="inp开发者_StackOverflowutfield" id="datepicker" />
</div>

Am I putting the JS in wrong place ? The path to the image is fine. The button will not appear next to the input text field. Thank you,


it works here http://jsfiddle.net/zPBv5/3/

you have to include jquery and jquery ui, and the order does matter

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript"></script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜