javascript - Dynamically add variables to html table -


this question has answer here:

i've created table here html.

<tr id='addr0'>     <td>1</td>     <td>         <input type="text" id='word0' placeholder='word'                 value="abhor" class="form-control" />     </td>     <td>         <input type="text" id='definition0' placeholder='definition'                 value="regard disgust , hatred." class="form-control" />     </td>     <td>         <input type="text" id='synonym0' placeholder='synonyms'                 value="detest, hate" class="form-control" />     </td> </tr> <tr id='addr1'></tr> 

how can use java script add array or variables in text areas. looked around , none of code found worked.

this i've tried:

<script>     document.getelementbyid("synonym0").innerhtml = "test"; </script> 

input elements' content accessed value attribute, not innerhtml. try:

document.getelementbyid("synonym0").value = "test"; 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -