H
H
Hlib2019-04-06 09:21:34
HTML
Hlib, 2019-04-06 09:21:34

Error when trying to change html text with React js, how to fix?

I'm trying to create an interactive leaderboard.
There was an idea: when you click on a cell, you could change the score.
However, this error pops up the
5ca8450f4e5ed301152321.jpeg
simplest function:

changeScore(e){
            let target = e.target.id;
            let a = prompt('Inter score', ' ');
            taget.texContent = a;

 }

If you need more code, I will send it
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Usikov, 2019-04-06
@Mysianio

I wouldn't recommend using React like this...
But try this:

changeScore(e){
     e.target.textContent = prompt('Enter score',  e.target.textContent);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question