Hi. I’ve implemented the Alert by Salman.
I can get the alerts to function well, and it’s a good alert app. Now I can’t get the onAction to fire on my page js.
export function button4_click ( event ) {
let alertPrivacy = {
message : “We Use cookies to store information! Accept our privacy policy!” ,
autoClose : false ,
closeLabel : “Accept” ,
onAction : handleAction ,
};
$w ( “#cealerts” ). setAttribute ( “newalert” , JSON . stringify ( alertPrivacy ));
}
function handleAction ( e ) {
/*
e => {
reason : reason, // action | timeout
message: message, // your message
id: id
}
*/
// save your cookie
console . log ( “yes” )
}
Here is a very simple example of an alert, with a button to accept. When I click the button, I do not receive the console message.
If I remove the handleAction() from the main page and run the page in live mode, a console error lets me know the function doesn’t exist, so it’s def. expecting it.
Here is the github link with the exact code example.
Any help ?