Does something like Element.getAttribute() exist in the Designer Ext API?

Hi,

I’m getting all Form elements on the current page with webflow.getAllElement() then filtering on all FormForm elements.

Now I would like to get the data-name attribute of the forms. But I can’t seem to find any method to retrieve attributes of a element.

I’ve tried getting the form element with document.querySelector but this does not work in the designer extension.

Is this possible in designer extensions? I know I can fetch the formSchema with the Data API, this will hold the name. But I would also like to get attributes of non-form elements.

Thanks!

Yes, there is a method which retrieves single attribute of the selected element or an element which you want.

If it is a custom element, you can use element.getAttribute(name), else you can use element.getCustomAttribute(name).

Where name=“data-name” in your case. Let me know if that works for you. :slight_smile: