Topic: Prevent Collapse after click on a specific tag on the header
Anas Qiblawi free asked 3 years ago
Expected behavior
When I click on "+ add new" collapse should not change its status.
Actual behavior
if I click anywhere on the collapse header the collapse change its status
Resources (screenshots, code snippets etc.)
https://mdbootstrap.com/snippets/standard/anas_qiblawi/3324014
Ray7 free answered 1 year ago
Hello,
Can you please help me with Custom javascript to keep expanded accordion open on onClick instead of collapsing?
Thanks Ray
Kamila Pieńkowska staff commented 1 year ago
Sorry, but can you explain more precisely what you want to do?
Michał Duszak staff answered 3 years ago
It's not a good idea to place an <a>
element inside a <button>
, because the <button>
element is responsible for the collapse.
Anas Qiblawi free commented 3 years ago
I know, but my question is that how can I place something on the accordion header and when I click on it, it won't triggering the collapse
Michał Duszak staff commented 3 years ago
In the header, outside of the button https://mdbootstrap.com/snippets/standard/m-duszak/3335978
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.9.0
- Device: ALL
- Browser: ALL
- OS: ALL
- Provided sample code: No
- Provided link: Yes
Michał Duszak staff commented 3 years ago
Your snippet gives me 404. Could you send a new one?
Michał Duszak staff commented 3 years ago
Your snippet gives me 404. Could you send a new one?
Anas Qiblawi free commented 3 years ago
New Snippet
https://mdbootstrap.com/snippets/standard/anas_qiblawi/3329443
Description
When I click on "+ add new" a modal will appear
but every time I click on it, the collapse also changes to open or close, and I don't know how to avoid it.
Code