javascript - Dynamically add variables to html table -
this question has answer here:
- set value of input field 9 answers
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
Post a Comment