79641647

Date: 2025-05-28 06:50:35
Score: 0.5
Natty:
Report link

Actually, I couldn't find an official answer. I tried a turnaround because of this.
I used custom CSS to prevent the cursor from appearing in the input field when a user clicks on it.
In order to prevent the user from typing anything, I also stopped the keypress event.

Example:

.readonly-bsDatepicker{
  caret-color: transparent;
  user-select: none;
}
<input
                type="text"
                placeholder="From"
                [bsConfig]="bsdatepickerConfig"
                class="form-control readonly-bsDatepicker"
                #dp="bsDatepicker"
                autocomplete="off"
                readonly
                bsDatepicker
                (keypress)="$event.preventDefault()"
              />
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Paramhans