What is the difference between "value" and "innerHTML" in javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between "value" and "innerHTML" in javascript

In some cases both "value" and "innerHTML" give the same result and in others the results are different.

8th Jun 2021, 8:04 AM
Priyangshu
Priyangshu - avatar
1 Answer
+ 3
Priyangshu "value" is use in case of text boxes and "innerHTML" is use in case of html tags. When you want to get or set value from any html tag then we have to use "innerHTML". When you want to set or get value from any input field then we have to use "value".
8th Jun 2021, 8:07 AM
A͢J
A͢J - avatar