Can't use the “onclick” attribute on a Webflow custom element

I tried to add the “onclick” attribute to a custom element in the properties tab, but when I publish the site and click on my element, nothing happens.
Am I missing something?

I’ve left more details in the Read-only link. I know some workarounds. I’m not trying to find one.
I thought it would be more powerful and easier to maintain to use Webflow’s custom element directly.


Here is my site Read-Only: LINK
(and the published site)

Hey @Guigz , I hadn’t encountered that limitation.
This is the community forum though, have you contacted Webflow support?

Hello @memetican
Thank you for answering. Sorry i didn’t know where to ask.
When i sent a message to the support, the Webflow support AI told me

Webflow’s custom attributes feature doesn’t support JavaScript event handlers like “onclick”

You told me you hadn’t encountered that limitation. How did you do it ?

Custom attributes and custom elements are different things, in my experience standard elements with custom attributes are restricted, but the attributes that you create on custom elements had no obvious restrictions. “No restrictions” was essentially the point of custom elements.

You’re the first person I’ve seen that’s mentioned one.

I’d contact support- it could be a bug or the devs may have a rationale for why certain limits need to exist.

My best guess is that those attributes can potentially conflict with interactions, and that support was getting messages from confused users who had created conflicts, and then thought that interactions was broken.

In essence that’s possible because there are more “importers” now, where you can absorb an existing site’s HTML into Webflow in the form of a huge hierarchy of custom elements. Those on* attributes would be difficult to find and fix.