Streaming live at 10am (PST)

Append HTML-element to collection item

Hi guys,

I want to append a HTML-video element to a collection item, using a link from the CMS as my source for the video. My problem is that I can’t target the specific item for appending the element.

This is my script.

(function createVideo() {
   const link = 'link from CMS'
   const updatedLink = link.slice(0, -4) + 'raw=1';
   const video = document.createElement('video');
   const source = document.createElement('source');
   source.src = updatedLink;
   source.type = 'video/mp4';
   video.controls = true;
   video.autoplay = true;
   video.controlsList = 'nodownload';
   const wrapper = document.getElementById('video-wrapper');

This is obviously not working since I’m getting all elements with id ‘video-wrapper’, hence I’m only appending all videos to the first video wrapper in the collection list.

Any ides for how I could append each video to each collection item separately?

Here is my site Read-Only: Webflow - entrance