Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: How to make input (type=date) field trailing icon clickable?

s2131335 free asked 1 year ago


I would like to make the input (type=date) field trailing icon clickable (to toggle my own date picker).

code snippet https://mdbootstrap.com/snippets/standard/s2131335/5865135

<div class="col-12 col-md-6 mb-4">
<div class="form-outline">
<i class="fas fa-exclamation-circle trailing pe-auto" style='cursor: pointer' onclick='alert("test");'></i>
<input type="date" id="course-startDate" class="form-control mb-0 form-icon-trailing" required />
<label class="form-label" for="course-startDate">Date</label>
</div>

Expected behavior: Clicking the trailing icon should trigger an alert pop up.

Actual behavior: Nothing happens when clicking the icon


Kamila Pieńkowska staff answered 1 year ago


The training icon was not designed with that use in mind so if you want to be able to click it you need to give it z-index higher than any forn-outline element.


s2131335 free commented 11 months ago

It works, thank you!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.0
  • Device: Macbook
  • Browser: Chrome
  • OS: MacOS
  • Provided sample code: No
  • Provided link: Yes