+ 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.
3 Respostas
+ 2
var elem = document.getElementById('name');
elem.innerHTML = 'My name is ' + name + ' and I am ' + age + ' years old';
+ 1
Share the code
+ 1
Shared