mishap
mishap

Reputation: 8505

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="inputfield" 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,

Upvotes: 0

Views: 887

Answers (1)

Rafay
Rafay

Reputation: 31033

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>

Upvotes: 1

Related Questions