Access to button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Access to button

Hi friends does anybody know how can I access to a clicked button in its onclick function in js?

30th Jul 2020, 5:05 PM
maryam mirzapoor
maryam mirzapoor - avatar
1 Answer
+ 1
maryam mirzapoor take a look at this code as it should help <button onclick="myFunction()">Random No. with Float</button> <p id="wflt"></p> <script> function myFunction() { document.getElementById("wflt").innerHTML = Math.random()*101; } </script> https://code.sololearn.com/WIVogKcpIpT8/?ref=app
30th Jul 2020, 5:13 PM
BroFar
BroFar - avatar