Answers for "react preventdefault stoppropagation not working"

1

event stoppropagation not working

// works like charm
function DownloadAsset(AssetId, e) {

    if (!e) var e = window.event
    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();

    // your ajax call
    $.ajax({....})
}
Posted by: Guest on September-23-2021
1

preventdefault not working react

//think if you are adding your submit handler function in the submit button
//or into the form itself
const handler = () => {
  e.preventDefault();
}
<form onSubmit={handler}> //good
<button type="submit" onSubmit={handler}> // bad
Posted by: Guest on October-15-2021

Code answers related to "react preventdefault stoppropagation not working"

Browse Popular Code Answers by Language