Detect change in dropdown value chosen

Hi,

I have dropdown and a button in my dash app. I would like to set the n_clicks of the button to 0 if the value chosen in the dropdown is changed. So, is it possible to identify change in dropdown values chosen. If so, how?

Hi @Rajesh, wellcome to the community,

Yes, you need to use a callback where the dropdown ‘value’ is the input and the button ‘n_clicks’ is the Output, like this:

@app.callback(Output('my_button', 'n_clicks'),
             [Input("my_dropdown", "value")],
)
def update_button(value):
    
    return 0