Hello & Thanks ,
I am baffled
copy from ‘textarea 1’ paste into ‘textarea 1’ only works for the first button-click .
The same button-click to ‘pre area’ works every time ?
Working all day , need new eyes .
Use .value. .innerHTML will lead to faulty behavior.
Is there a good reason to use a loop here?
You would only need it if you were to use this component multiple times on a page. And then on button click you would copy ALL textareas to the other textarea. Which is not really meaningful.
Yes , the reason is that I will be expanding program
to add more textarea elements . So I want to debug it
before I go further.
Problem:
Currently , if I click once on ‘textarea 1’ button ,
content in ‘textarea 1’ is copied into ‘textarea 2’ .
If I then erase what’s in textarea 2
And click again on ‘textarea 1’ button ,
nothing gets copied into ‘textarea 2’ .
But I am confused because of these rules:
console.log(toConsoleLogId.value); if you want what’s typed in the box, or
console.log(toConsoleLogId.innerHTML); if you want what was hardcoded into the text box’s HTML.
Ugh!
My prob was not creating new textarea s with the class=“copyFrom” .
Hence no new ‘copyFrom’ elements .
Also , I am better understanding .value vs .innerHTML .
Thanks