learning-area icon indicating copy to clipboard operation
learning-area copied to clipboard

Question: how to handle multiple transcripts on one page

Open jaszjas3000 opened this issue 2 years ago • 0 comments

If there are multiple pieces of media on one page, the second transcript doesn't open on click. Is there a way to work around this?

I was trying something like this?

`var transcripts = document.querySelectorAll('.transcript'); var transcriptBtns = document.querySelectorAll('.transcript-container button');

transcriptBtns.forEach(function(transcriptBtn) {

transcriptBtn.addEventListener('click', function() { if(transcriptBtn.textContent === 'Show transcript') { transcripts.style.height = '250px'; transcriptBtn.textContent = 'Hide transcript'; } else { transcripts.style.height = '0'; transcriptBtn.textContent = 'Show transcript'; } };

}`

jaszjas3000 avatar Dec 23 '21 04:12 jaszjas3000