javascript - Setting content of a textarea with innerHTML from an onclick event only works once -


i'm trying update content of <textarea> field when <button> clicked onclick="" event.

my problem button works once. if change content of text area button doesn't work anymore.

i've found several questions same problem use variable inputs or not random data.

you can see example here:

  1. click on add test data button
  2. modify content of textarea
  3. repeat step 1.: button doesn't work console register done message

<script>    function addexample() {      document.getelementbyid('fasta').innerhtml = 'acgt';      console.log('done');    }  </script>  <p>    <button type="button" onclick="addexample();">add test data</button>  </p>    <textarea name="fasta" id="fasta"></textarea>

i'm using firefox 44.0 on ubuntu 15.04.

ps: i've found several questions same problem on use variable inputs or not random data.

dont use innerhtml value property.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -