I have a 3 date picker fields. I have disabled the field but the date picker icon is fully functioned. Can any one tell me how to disable it's function?
2 Answers
To hide the datepicker image use css,
<style>
.ms-dtinput > a {
display: none;
}
</style>
Update
Using pure JavaScript
<script type="text/javascript">
function clickDatePicker()
{
document.getElementsByTagName('a').onclick = null;
}
</script>
This will disable all date pickers on the page. I tested on item edit page with Script editor webpart.
try this,
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js”></script>
<script>
$(document).ready(function()
{
$(“input[title$=’ShowFields’]”).click(function()//metion field names that you need to be in your form
{
$(“input[title$=’datepicker1’]”).parent(‘span’).parent(‘td’).parent(‘tr’).toggle();//mention the field names that you need to hide or disable from your form
$(“input[title$=’datepicker2’]”).parent(‘span’).parent(‘td’).parent(‘tr’).toggle();//mention the field names that you need to hide or disable from your form
$(“input[title$=’datepicker3’]”).parent(‘span’).parent(‘td’).parent(‘tr’).toggle();//mention the field names that you need to hide or disable from your form
});
});
</script>
try this too
How to make datepicker readonly from javascript?
try this too
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$( "td.ms-dtinput > input[id$='DateTimeFieldDate']" ).attr('readonly', 'readonly');
$( "td.ms-dtinput > a" ).attr('onclick','').unbind('click'); });
</script>
-
It's not working.The date picker functionality is still not disabled Oct 11, 2017 at 17:34
-
did you tried below-posted URL ..?(How to make datepicker read-only from javascript?)– karthikOct 11, 2017 at 18:33
-
-
replace id$='DateTimeFieldDate' with title$=’datepicker title’ $( "td.ms-dtinput > input[title$=’datepicker title’ ]" ).attr('readonly', 'readonly');– karthikOct 12, 2017 at 17:08
-