Ionic 5 plain javascript inline events

can’t I just bind inline event on ionic component?
like:

<ion-button id="btn-focus" ionFocus="console.log(1)" >

it works this way though:

            let focusbutton = document.querySelector("#btn-focus");
            focusbutton.addEventListener("ionFocus", () => {
                console.log("focused");
            })

Binding events is generally something that I let frameworks do, because it’s something they’re designed for.

1 Like

what language are you using? is this angular, react or vue?

plain javascript.
general event worked:
<ion-button id="btn-focus" mode="ios" onclick="console.log(2)" >
but not one of ionic

in the end it what is passed to javascript for treatment and I just want use it javascriptish way