Stop background video loop

Hello all,

I have tried two solutions I have found online to stop the background video loop, but all in vain.

First code:

**<script type="text/javascript">**
**    $(document).ready(function() {           **
**            $("videoID").removeAttr("loop");**
**    });**

Second code:

**<script> Webflow.push(function() { document.getElementById('videoID').querySelector('video').removeAttribute('loop'); });**

Both codes don’t seem to work, even after I have check the video ID matches the code.

Hoping someone figured it out.


1 Like

Hello @dlimonchik

Here’s a similar script, but maybe will work

Click on your BG video element > open settings > set an ID for the video

<script type="text/javascript">

Paste the code before the closing body tag

Piter :webflow_heart:

Assuming you gave the background video element a custom ID of ‘Video’:

<script type="text/javascript">
document.getElementById( 'Video' ).getElementsByTagName( 'video' )[0].removeAttribute("loop");;
1 Like

Where does this get pasted? I try putting it into the custom code section, but none of the scripts I’m finding work.

What does “Paste code before the closing body tag” mean?

Thank you for your help.