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)

function myFunction() {
  var copyText = document.getElementById(" myInput + form1.num.value ");;
  alert("Copied To Clipboard: " + '\n' + copyText.value);

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

I don’t know what form1.num is, but try

var copyText = document.getElementById("myInput" + form1.num.value);


var copyText = document.getElementById("myInput" + document.getElementById("num").value);
1 Like

Yes - the first one worked great, thanks again Pat.