Custom Attribute Not Appearing in Published Site

I have a select element in a form with a custom attribute, however, when I publish the site to test, the attribute doesn’t appear in the code.

The custom attribute is onchange=“ShowHideDiv()”
There is a hidden DIV in a form that appears when a specific option is chosen.

Is there any reason why I can add the attribute but it doesn’t appear in the published code?

Hey Alan! Welcome to the Community! Do you mind sharing both your read-only link (see how here) and your published ( link), and let me know which page you have the form with the custom attribute?

Looking forward to your response!

Hi Matt,

Thanks for responding on a Sunday! The read-only and published links are below. The form will be on most pages so is set up as a symbol. I initially thought that might be an issue so I unlinked it but the same problem persisted.

The page I’m using to test is the about page.


Sure thing! That’s quite unexpected - not sure why that’s happening. @webdev @rileyrichter - any thoughts?

I can take a deeper look at this tomorrow, but as a quick (code-based) fix is to add this custom code to your website’s head:


    var Webflow = Webflow || [];
    Webflow.push(function () {
        document.getElementById('Service').setAttribute("onchange", "ShowHideDiv()");


Hoping someone else can figure out why the attribute isn’t being added natively with Webflow, but the code above should get you taken care of. It says: on page load, add the attribute to the select dropdown (targeted by using the ID you already have on the element.)

Hope that helps somewhat!

1 Like

Thanks for getting back so quickly. That solution works and will be enough to show the client to push it over the line. It’s rare that I have to use the custom attribute but thought I better flag it either way.

Cheers and thanks again,

1 Like

For sure - I haven’t seen a custom attribute not show up on the published website before, so I’m curious as to why that might happen as well!

Just flagging that I’m having the exact same issue as Alan here, also trying to add a custom attribute on a select element. Matt’s solution also works for me, but looks like this may be a bug that still needs to be fixed

1 Like

I have the same issue described here. Just posting a comment here in case this gets solved in the future

Also having the same issue with the custom attribute “ondragstart” with a value of “drag(event)”.

Also having this issue with the form, i’m not able to add target, novalidate, or data-form-email

The same issue is still there!

Please fix it so that we can add custom attributes in a more native way

Same, seems like it hasn’t been fixed yet

Same issue today, attribute is not visible in public HTML code.