Build an Alert Component Using Custom Elements

Hi. I’m unable to get the onAction event to run the function.

$w ( “#cealerts” ). setAttribute ( “newalert” , JSON . stringify ({ title : “Confirm Buy Order” , message : " Click button to confirm." , type : “info” , closeLabel : “Confirm” , onAction : handleAction }))

function handleAction ( e ) { /* e => {reason : reason, message: message,id: id} */ console . log ( e.message ) }

The alert opens, but when I click the ‘Confirm’ button, the handleAction function does not trigger.

Please help haha.

Apart from that I like it !