1

I want to set the today's date to the DateTime control of sharepoint. My code is:

$(document).ready(function () {
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!

    var yyyy = today.getFullYear();
    if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} var today = dd+'/'+mm+'/'+yyyy;
    var today= mm+'/'+dd+'/'+yyyy;  
    $( "td.ms-dtinput > input[id$='DateTimeFieldDate']" ).val= today;   
});

But I am not getting the value inserted in the DateTime conrol's text box. What am I missing?

1 Answer 1

3

you can't set value like this

$("DateTimeControlID").val = "date";  

you have to set value like this

$("DateTimeControlID").val("date");
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.