Button double-click to trigger JS function in MS Edge


Topic: Button double-click to trigger JS function in MS Edge

lldev19 asked 2 years ago

I have a button that has a function set in its onclick

Originally, I started with regular Bootstrap 5 and my JavaScript was successfully called with a single click in MS Edge.

I just recently swapped in MDB CSS/JS, and now I need to double-click my button in order for the JS function to run. I also only need a single click in Chrome.

I do not get any errors on a single click in the console. It's just that nothing appears to happen except for the button's little click/wave animation.

I'm not totally sure what's going on here? I don't have anything complex, either. Very basic onclick

<input id="viewButton" type="button" class="btn btn-primary" value="View" onclick="getSelectedRow(e)" />

    function getSelectedRow(e) {
        //...code here that only runs on double-click in MS Edge
}

mlazaru staff answered 2 years ago

This probblem is related to newest MDB update. Input with type button or submit does not work with click event. And it's not only bugged in Microsoft Edge.

We will fix this soon, but until we do that i recommend to use button instead of input, or listen to mousedown event on input.

Snippet: https://mdbootstrap.com/snippets/standard/mlazaru/4336286


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
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 4.4.0
  • Device: Desktop PC
  • Browser: MS Edge
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No