R
R
reactreact2015-12-07 18:44:02
JavaScript
reactreact, 2015-12-07 18:44:02

How to clear textinput on button click (react-native)?

It is necessary that when the button is pressed, the value of the textinput is cleared, how to do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2015-12-08
@reactreact

You can do this https://rnplay.org/apps/214S0w

M
MNB, 2015-12-07
@MNB

document.querySelector('#myButton').addEventListener('click', function(e){
    e.preventDefault();
    document.querySelector('#myTextarea').value = '';
}, false);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question