0

Created a web part page to test initializing SharePoint controls via javascript, can't get the date picker working. Its been driving me nuts for hours now. Anyone see any obvious mistakes?

<input id="txtDate" type="text"/>

<script src="https://code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="_layouts/15/datepicker.js"></script>
<script type="text/javascript">

function FormLoaded() {
$("#txtDate").datepicker();
}
window.onload = FormLoaded();
</script>

have also tried other variants:

$(".txtDate").datepicker();
$('input[id$=txtDate]').datepicker();
$("input[id='txtDate']").datepicker();

I really don't want a custom picker (jquery ui is fugly), I just want to leverage what SharePoint already has.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.