How to output value of a button in js when the button is clicked? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to output value of a button in js when the button is clicked?

6th Apr 2018, 9:29 PM
Evil Dog
Evil Dog - avatar
3 Answers
+ 1
Output where? Anyway, just use the click event, grab the value of the input, and output it. document.getElementById('button-id').addEventListener('click', function() { console.log(document.getElementById('textbox-id').value); });
6th Apr 2018, 9:53 PM
Maicon Mauricio
Maicon Mauricio - avatar
0
If you learnt and tried to understand JavaScript course on SoloLearn, you wouldn't have to ask here.
6th Apr 2018, 10:14 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
Can you please help me here pls? https://code.sololearn.com/Wj1MQ6T1o4U7/?ref=app
7th Apr 2018, 9:16 AM
Evil Dog
Evil Dog - avatar