开发者

jquery DatePicker altfield

I have following function in my asp.net MVC view:

$(function() {
$('#datepicker').datepicker({
changeMonth: true,
        dateFormat: "dd M yy",
        changeYear: true,
        showButtonPanel: true,
        autoSize: true,
        altField: "#txtDate",
        onSelect: function(dateText, inst) {           
            $.ajax({
                type: "POST",      开发者_C百科         
                url: "/LiveGame/Partial3?gameDate=" + dateText,               
                 dataType: "html",
                success: function(result) {                  
                    var domElement = $(result); 
                    $("#dvGames").html(domElement); 
                }
            });
        }
    });

    $('#dvGames').load(
    '<%= Url.Action("Partial3", "LiveGame") %>',
    { gameDate: $("#txtDate").val() }
);
});

I have two input elements|:

<input type="text" id="txtDate" name="txtDate" readonly="readonly" class="cornerdate" />
<input id="datepicker" class="cornerimage" type="image" src="../../Content/images/calendar.gif" alt="date" />       

But txtDate is not filled with current date when page loads even i specified altfied. How can I fix it?


There is no 'altFormat' value Set

altFormat : "dd M yy"

The default is Blank


I don't see any reference to setdate in there. In general you just use something like:

$("#txtDate").datepicker('setDate', new Date());

Try making a call to that outside of the function even just in your document.ready() portion and your field should populate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜