Reputation: 2493
I am using HTML5 with phonegap. I have a table defined as follows.
<table id = "myTable">
<tr><td>Name</td><td class="center">:</td><td><div id="name"></div> </td></tr>
<tr><td>Age</td><td class="center">:</td><td><div id="age"></div> </td></tr>
<tr><td>Country</td><td class="center">:</td><td><div id="country"></div> </td></tr>
</table>
I want to set values to "name", "age", and "country" from javascript. I tried it as follows.
document.getElementById('name') = 'John'
But this doesn't give me the required output. How can that be done? Thank you.
Upvotes: 0
Views: 111
Reputation: 2288
You can set innerHTML to set html inside an element.
document.getElementById('name').innerHTML= 'John'
Upvotes: 1