Into NewForm.aspx
I have Date and Time field, which I disabled via jQuery.
My computer is set to 14:46
, so I will receive 14:45
in SharePoint. Hour is correct but minutes are not; it is always set as 00
.
Column Setting
Field in NewForm.aspx
JS to disable date and time column
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
var itemID = $("input[title='Fecha']").attr("id");
// Trim the Item ID and keep the first part which is common for each element of this DatePicker
var itemCode = itemID.substring(0, itemID.indexOf('$'));
// Set text input to readOnly
$( "[id^=" + itemCode + "] td.ms-dtinput > input[id$='Date']" ).attr('readonly', 'readonly');
$( "[id^=" + itemCode + "] td.ms-dtinput > input[id$='Date']" ).attr('disabled', 'disabled');
// Disable the onclick action on the button
$( "[id^=" + itemCode + "] td.ms-dtinput > a" ).attr('onclick','').unbind('click');
// Disable the 2 time select elements
$( "[id^=" + itemCode + "] td.ms-dttimeinput > select[id$='DateHours']" ).attr('disabled', 'disabled');
$( "[id^=" + itemCode + "] td.ms-dttimeinput > select[id$='DateMinutes']" ).attr('disabled', 'disabled');
});
</script>
Regards.