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!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Resposta
+ 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