I can't get datepicker to work
Posted
by vikitor
on Stack Overflow
See other posts from Stack Overflow
or by vikitor
Published on 2010-05-26T12:24:40Z
Indexed on
2010/05/26
13:31 UTC
Read the original article
Hit count: 374
Hi, I need a field that displays the datepicker. I followed the example given by the JQuery UI documentation and haven't managed to get it to work. My html where I have my text field is:
<div class="editor-field">
<input type = "text" name = "DatePublished" id = "Published" />
<%= Html.ValidationMessage("DatePublished" ,"*") %>
</div>
This HTML is in a partial view, lets call it pv.ascx, and it is called in the main page as a modal box:
<div id = "ModalBox">
<% Html.RenderAction("pv", "Example"); %>
</div>
The thing is, that I try to call the datepicker creation anytime I enter the main page, and I do it in my javascript file app.js:
$().ready(function() {
var place = window.location.pathname;
var placesplit = place.split("/");
//Depending on the location we are on, we execute different subroutines
$('#Published').datepicker();
});
But nothing happens when I focus on the text field. What is wrong? Could it be that being called from a partial view it doesn't work?
Thank you everyone, vikitor
© Stack Overflow or respective owner