• Login

Snippets

29

Set value of a textbox to today's date using jQuery:

 $("#<%= cbxLeaseSentToOwner.ClientID %>").click(function () {

                var isChecked = $('#<%= cbxLeaseSentToOwner.ClientID %>').is(':checked');
             
                if (isChecked) {
                    var myDate = new Date();
                    var prettyDate = (myDate.getMonth() + 1) + '/' + myDate.getDate() + '/' + myDate.getFullYear();
                    $("#<%= txtLeaseSentDate.ClientID %>").val(prettyDate);
                }
                else
                {
                    $("#<%= txtLeaseSentDate.ClientID %>").val("");
                }

            });

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Name (required)

Email (required)

Website