Z
Z
zhodino2018-09-10 18:09:21
React
zhodino, 2018-09-10 18:09:21

How to get attribute value on click?

<div onClick={(e) => console.log(e.target.name)} name="asdasda">adadsasd</div>

How can I get the value of the name attribute?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2018-09-10
@zhodino

https://developer.mozilla.org/en-US/docs/Web/API/E...
name is a special attribute. You can't put it anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question