✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

How to make action after click on button?

I’d like to make a complex page which allows me to read text/options from inputs. First of all I’d like to make a button that invoke a method and pass text from textarea after click on it. This is my code, I don’t want send anything to output. How to do it?

management_page= html.Div([

            dcc.Input(id='name',placeholder='Enter a value...',type='text',value=''),

def addNew(value):

use the property n_clicks instead of value

Look here - I have these tabs.

If i click on tab “Management” callback is called - i don;t want it. When I click on button callback is called and property n_clicks is updated.
Callback invoke other methods which have to be invoked only when button is clicked

My code now:

management_page= html.Div([

            dcc.Input(id='name',placeholder='Type a name',type='text',value=''),
            "Choose elements",
                {'label': 'g1', 'value': 'g'},
                {'label': 'b1', 'value': 'b'},

def addNew(click):
    #other methods here

EDIT: So, I’ve decided to use time_stamp. Now my code looks like this:

def addNew(click):
    if click is not None:
        #my code here
        return #do nothing

So, I think it’s done :wink: