Is it possible to modify a text/number composite based on an inputed value

I have these things in my code.

<textarea id=“myInput1” dmx-bind:value="’[table]

<textarea id=“myInput2” dmx-bind:value="’[table]

I want to select one with the code below based on the value in form1.num.value (num.value can be 1 or 2)

<script>  
function myFunction() {
  var copyText = document.getElementById(" myInput + form1.num.value ");
  copyText.select();
  document.execCommand("copy");
  alert("Copied To Clipboard: " + '\n' + copyText.value);
}
</script> 

It is not working, am I messing up the syntax in the function?

Community Page
Last updated: