autoPlay attribute is busted with error

I must set autoPlay attribute without manual export.

Error: This is a reserved name.

See screenshot




Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hi @miekwave

There are several reserved attributes that you aren’t able to use. Here is a workaround that may help: Google Analytics event tracking for buttons in Webflow


I must bypass the ‘Reserved name’ error. How do I ‘SAVE’ even with the reserved name warning?

Hey @miekwave !

While we do not provide custom code help I thought this might put you on track for completing your project :slight_smile: There are two ways of setting custom attributes that are reserved in Designer: via custom code or embed component.


Add Panel → Components → Embed

From then on you can simply add any custom node with custom attributes that you wish.

<div autoplay="true"></div>

Custom Code

Ok here’s the magic… You can set the custom attribute to data-autoplay instead of autoplay and then we can use custom code to change any existing node with data-autoplay attribute. Here’s the code with comments to explain what it does:

<script> // we have to wrap the script in the <script> tags
  // wait until the document (html) is loaded
  $(document).ready(function() {
    // find all nodes with `data-autoplay` attribute and store in an array
    var apl = document.querySelectorAll('[data-autoplay]');
    // iterate over the array and for each element...
    apl.forEach(function(item) {
      // add attribute `autoplay` with value `true`
      item.setAttribute('autoplay', 'true');

So the original div:

<div data-autoplay="true"></div>

will convert into

<div data-autoplay="true" autoplay="true"></div>

Hope this helps! :slight_smile:

1 Like

See screenshot

The following attributes work as intended:

The following is broken:
I MUST save autoPlay=true as an attribute.

Background info:
User logs into website. User clicks on help link containing video. Video must Autoplay for 20 seconds and I have interactions popup at 18 second mark. User clicks on one of the interactions based on video.

Manually exporting webflow project editing html file for this is a huge ftp timesink (lots of pages manual find replace code), PLEASE make it where can do autoPlay attribute so I dont have to go back to ftp or doing manual embedding modifications to a bunch of pages.

Hi @miekwave

As much as I wish we could, at this time there isn’t a way to un-reserved the autoPlay attribute. Instead, can you please refer Bart’s workaround above?

Thanks for your understanding :bowing_man:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.