views:

21

answers:

1

Why would when using this code in one place set the default as it should but not when moving first two statements into Master file and the last one into View file (ASP.NET MVC app)?

$(function () {
$(".editDate").datepicker({ dateFormat: 'dd.mm.yy' });
$(".editDate").datepicker($.datepicker.regional['sl']);
$("#IssueDate").datepicker('setDate', new Date()); // if I separate this one into it own file, it never sets the default date
}); 

??

A: 

without seeing the rest of the code, I would guess that you are trying to call "setDate" before the js that actually turns your input into a datepicker gets called.

Kelly
That's exactly what was going on, the Datepicker enable code was being run after I tried to set the default date with setDate. This was due to me having something messed up with Master and View files.
mare