How do I pass a value from any table cell when clicked to Text box in html using JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I pass a value from any table cell when clicked to Text box in html using JavaScript?

I want to use this in developing a calculator app in html.

18th Mar 2018, 1:15 PM
Emmanuel Arthur
1 Answer
+ 1
Use this as an attribute of the table cells onclick=“textBoxFunc(this.innerHTML)” Then the JavaScript would be: function textBoxFunc(text){ document.getElementById(“textBoxId”).innerHTML = text; }
18th Mar 2018, 3:04 PM
Ariela
Ariela - avatar