2👍
✅
For question #1, you can use:
//Copied from @hiws answer
//this will have the benefit of having a unique parent div
//from which copy the entire content
<div id="thread-id">
<b-card-text v-for="...">
<!-- Content to copy -->
</b-card-text>
</div>
For question #2: Use innerText
instead of innerHtml
, this won’t give you the markup.
var copyText = document.getElementById(id).innerText;
1👍
You’re almost there.
The issue is you’re generating 3 divs
with the same id
.
and document.getElementById(id)
will only retrieve the first one.
Instead wrap your v-for
in another div and place the id on that element.
<div id="thread-id">
<b-card-text v-for="...">
<!-- Content to copy -->
</b-card-text>
</div>
👤Hiws
Source:stackexchange.com