+ 1

JavaScript Getting Element

While getting element by id and you have a variable var name="Adam"; var age="30"; and you want the statement. My name is Adam and I am 30 years old. Giving that the id is name.

13th Mar 2020, 7:35 PM
Al Amin Abdullahi Daho
Al Amin Abdullahi Daho - avatar
3 Respuestas
+ 2
var elem = document.getElementById('name'); elem.innerHTML = 'My name is ' + name + ' and I am ' + age + ' years old';
13th Mar 2020, 7:40 PM
Ore
Ore - avatar
+ 1
Share the code
13th Mar 2020, 7:37 PM
Ore
Ore - avatar
+ 1
Shared
13th Mar 2020, 7:39 PM
Al Amin Abdullahi Daho
Al Amin Abdullahi Daho - avatar