'Disable HTML datepicker with calendar icon using jquery
I have the following UI,
I've set when dropdown select "None" Date From and Date To pickers are disabled, but still calender icon is clickable this is the issue
when dropdown select "Other" Date From and Date To pickers are enabled, in correct behaviour
for this, the code snippet is like this
<td>
<%: Html.DateTimeTextBoxFor(m=>m.DateFrom, "dd/MM/yyyy", new { showpicker = true }) %>
</td>
<td>
<%: Html.DateTimeTextBoxFor(m=>m.DateTo, "dd/MM/yyyy", new { showpicker = true }) %>
</td>
script portion
function DropDownChange(isShow)
{
if(isShow)
{
$('#DateFrom').removeAttr('disabled');
$('#DateTo').removeAttr('disabled');
}
else
{
$('#DateFrom').attr('disabled', 'disabled');
$('#DateTo').attr('disabled', 'disabled');
$('#DateFrom').val('');
$('#DateTo').val('');
}
}
I'm trying to hide calender icon or disable the onclick action for this calender button from this
Solution 1:[1]
You can try this, it will set showpicker's value to false
$("#DateFrom").attr('showpicker', false);
OR try to hide the textbox itself
$("#DateFrom").hide()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


