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: icon in button for mdal loading

ochicaud priority asked 1 year ago


I have a button to load a modal. Same thing with a

< a class="btn

if there is text in the button, it's ok. if there is a font-awsome icon, there is a js error wen you click on the icon. It's launched anyway

see exemple

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/ochicaud/5776659


ochicaud priority answered 1 year ago


Actually, it was it little bit more complex than that, because I execute js to fill the modal in when i click the button. but I duplicated all my parameters from my "a" btn to my "i" content, and yes, it works like a charm.

So, Thank you, Kamila

 <a class="btn btn-floating text-white bg-deep-orange-500" 
 menuItemEditButton 
 id="btn@(mei.Code)"
 data-mdb-toggle="modal" 
 data-mdb-target="#modalEditMenuItem" 
 data-menu-code="@mei.MenuCode" 
 data-menu-item-code="@mei.Code">
     <i class="fas fa-edit"
        menuItemEditButton
        data-mdb-toggle="modal"
        data-mdb-target="#modalEditMenuItem"
        data-menu-code="@mei.MenuCode"
        data-menu-item-code="@mei.Code"></i>
 </a>

Kamila Pieńkowska staff answered 1 year ago


It's because placing a child in the toggle button interferes with the logic that initiates modal. Adding the same target attribute value to the i tag e.g. data-mdb-target="#exampleModal" will remove this error.



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: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.2
  • Device: pc
  • Browser: all
  • OS: w10
  • Provided sample code: No
  • Provided link: Yes