ClassName toggle via JS Event Listener not registering in callback

Hi @jinnyzor ,

thanks for welcoming me and thank you for your input! I’ve built some fun and some very useful things with Dash so far, this time round I might feel a little too comfortable and misuse it for an MVC style problem, albeit a simple one…

Sadly your code suggestion did not work, both ways neither registered in the frontend nor in the backend… however (!), this little guy does the trick:

document.addEventListener('keydown', (event) => {
    var name = event.key;
    var code = event.code;
    if (code.includes('ArrowLeft')) {
        var element = document.getElementById("div1");
        element.click()

Thanks everyone!

1 Like