With JS add default date on TextBox

Posted by senzacionale on Stack Overflow See other posts from Stack Overflow or by senzacionale
Published on 2010-06-02T17:51:47Z Indexed on 2010/06/02 18:04 UTC
Read the original article Hit count: 131

Filed under:
|
<asp:TextBox ID="txtDate" runat="server" AutoPostBack="true" OnTextChanged="txtDate_TextChanged"></asp:TextBox>

how can with Jquery add default date. I do not know where and when to call this code:

function addDefaultDate() {
    if ($('#txtDate').val().length == 0) {
        var now = new Date();
        $('#txtDate').text(now.getDate() + '.' + now.getMonth() + '.' + now.getYear());
    }
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about aspx