Topic: Modal button click event
ShirleyMD priority asked 4 years ago
How to fire a button click event from a button inside a Modal Popup? All the examples show how to use data-dismiss to close the modal but I could not find any examples to pair a button click event or a function with the other action button or the non-close button.
For example, in the hide.bs.modal event, how can I differentiate which button from the modal popup was "Clicked".
Thanks... Shirley
ShirleyMD priority answered 4 years ago
Thanks Grzegorz....I already tried to attach my own event but it seems the event is lost and have tried the conventional (1)asp.net button with server click event; (2) html button; (3) event listener, was hoping MDBootstrap's modal will offer an example.
The jQuery Dialog will work since it has a button property where i can differentiate whether the Yes button or the No button was clicked. But I will lost the MDBoostrap design.... How about from an MDBootstrap modal....all the examples shows data-dismiss but not the other action button. I tried to use the for the Yes button and it would not navigate anywhere? Any suggestions?
Grzegorz Bujański staff commented 4 years ago
To be honest, I don't know any other way than bind new events. I made a snippet for you that shows that it is possible and works: https://mdbootstrap.com/snippets/jquery/grzegorz-bujanski/2140331
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: 4.18.0
- Device: PC
- Browser: Chrome, IE
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 4 years ago
Hi. this events does not return this information. Why don't you just add your own event to the button?