# Changing the value of a input from javascript callback does not trigger the callback associated with that input

**URL:** <https://community.plotly.com/t/changing-the-value-of-a-input-from-javascript-callback-does-not-trigger-the-callback-associated-with-that-input/82922>\
**Category:** Dash Python\
**Tags:** question\
**Created:** [March 10, 2024, 10:33pm UTC](https://community.plotly.com/t/changing-the-value-of-a-input-from-javascript-callback-does-not-trigger-the-callback-associated-with-that-input/82922 "2024-03-10T22:33:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)\
**Post date:** [March 10, 2024, 10:55pm UTC](https://community.plotly.com/t/changing-the-value-of-a-input-from-javascript-callback-does-not-trigger-the-callback-associated-with-that-input/82922/2 "2024-03-10T22:55:56Z")

</div>

Hi @mainul

Good timing! This is possible as of dash 2.16.1 by using `dash_clientside_set_props`  
The docs aren’t available yet, but you use it like this:

```auto
dash_clientside.set_props(id, {props to set})
           

```

so in your case it would be:

```auto
dash_clientside.set_props("last-key-pressed", {value: event.key})

```

Here’s the whole callback

```auto

app.clientside_callback(
    """
    function(n_clicks) {
        document.addEventListener('keydown', function(event) {
            const allowedKeys = ['ArrowLeft', 'ArrowRight', 'Enter'];
            if (allowedKeys.includes(event.key)) {
                dash_clientside.set_props("last-key-pressed", {value: event.key})
            }
        });
        return window.dash_clientside.no_update; // Return no_update if not an allowed key
    }
    """,
    Output('last-key-pressed', 'value'),
    [Input('invisible-button', 'n_clicks')],
)

```

---

_[View the full topic](https://community.plotly.com/t/changing-the-value-of-a-input-from-javascript-callback-does-not-trigger-the-callback-associated-with-that-input/82922)._
