Developer’s POV, work with the dom

Hello :slight_smile:
I’ve been trying Wix/EditorX from a Developer perspective and have some questions so far.

Can we work directly with the DOM for some complex interactions? (create Elements on the fly, appendChild, data-attribute, working with SVGs, etc)
Is there a way to add some custom HTML and CSS, or do we have to do everything from the editor?
I have built and saved a section that I want to reuse on other pages and order websites. The behavior (animations, toggles, etc) is controlled by Javascript. How can I save a reusable section which depends on some custom scripts? Should I use Wix Blocks instead? Or create a Velo Package?

Can please help me with this? I’m new to the Wix Ecosystem and I would also be glad to have some tips about how to get started from a Developer’s POV.

Thank you!

Yes you can ----> ON PREMIUM-SITES ONLY <-----
More operational element is the CUSTOM-ELEMENT, there you can build your own WORLD.

That is, I understand correctly, I have to book a premium package first so that I can interact with the DOM?

You can use two different types of Wix-Sites.

a) free Wix-Websites —> CUSTOMlELEMENT + HTML-COMPONENT will have boundaries

b) payed Wix-Websites —> CUSTOMlELEMENT + HTML-COMPONENT won’t have boundaries

I want to pass data from a collection inside my CustomElement. Basically I have a repeater, connected to a dataset. When I click in a repeater Item, i want to pass the Item informations to the customElement and render it by adding it to the dom inside the customElement. (eg. with appendChild). How can I have achieve this? I tried to use attributeChangedCallback but this seems to rerender the customElement and causing the previously added Items to disappear.
I tried:

  • call a Function inside a customElment

  • dispatch a CustomEvent wich will be handled by the Custom Element

  • access wix-data inside the customElement
    none of these worked

Where is your tried code?

Hello :slight_smile:
thanks first of all for your help, we come from LocomotiveCMS and are thinking of migrating a lot of websites to Editor-X.

Here on the website, we have already developed something like this →

These are our first attempts / tests, we wanted to see how easy or difficult it is to import this into Editor-X.

On this website of Editor - X:

We are currently trying the whole thing via the GitHub connection Editor X Local and Velo.

I will send a code example right away

We have now made a public Github under Public → SRC is then the faq example.

Interesting, but i do not understand Git-Hub and how it works.
I am using the normal Wix-Editor.

Maybe you can explain a little bit about your work?

  1. What do you present here?
  2. Which kind of functionality does your project offer?
  3. Which advantages does it offer?
  4. What else can be learned from your post?

I am “almost” master if it comes to VELO-CODING, but if it comes to use a REPO in GitHub → i am out :grin: (not my world). Maybe in future.

class FaqChat extends HTMLElement {
    constructor() {
        this.chatContainer = this.createElementWithCLass("div", "faq-chat-container")
        const style = document.createElement("style");
        const chatHeader = this.createElementWithCLass("div", "faq-chat-header")

        const headerImage = this.createElementWithCLass("img", "faq-header-img")
        const username = this.createElementWithCLass("div", "faq-header-username")
        username.textContent = this.hasAttribute("user-name") ? this.getAttribute("user-name"): "username"


        const chatMsgContainer = this.createElementWithCLass("div", "faq-chat-msg-container")

        const chatFooter = this.createElementWithCLass("div", "faq-chat-footer")


    connectedCallback() {

        this.addEventListener('addChatMsg', (event) => {
            console.log("hey");//this event is not being triggered
        // wixData.query("FAQ").find().then(console.log).catch(console.log)

    attributeChangedCallback(name, oldValue, newValue) {   
        if (name === 'in-msg') {
          this.querySelector('.faq-chat-msg-container').appendChild(this.getChatMessage(newValue, true));
        if (name === 'out-msg') {
      // Code for a special lifecycle function observedAttributes()
      // that checks specific attributes on the page. 
    static get observedAttributes() {
        return ['in-msg', 'out-msg'];

    getChatMessage(msg, incoming = false) {
        const msgElement = this.createElementWithCLass("div", "faq-msg")
        msgElement.textContent = msg
        if (incoming) {
   = "blue"
   = "#fff"
        } else {
   = "green"
   = "#000"
        return msgElement

    updateStyles() {
        this.querySelector("style").textContent = `
            .faq-chat-container {
                height: 100%;
                background-color: #fff;
                display: flex;
                flex-direction: column;
                justify-content: space-between;

            .faq-chat-header {
                background-color: red;
                display: flex;
                align-items: center;
                color: white;
            .faq-chat-msg-container {
                flex: 2;
                align-items: center;
                color: white;
            .faq-chat-footer {
                background-color: blue;

    createElementWithCLass(tag, style) {
        const element = document.createElement(tag)
        return element

customElements.define("faq-chat", FaqChat)

Here the code
we want to make

We would like to recreate the same element as from one of our pages.

If you look a little further down, the chat module:

So you have already worked with custom elements?

Try to use the SERACH of the VELO-FORUM…

So, as i understand you want to start to work from Wix-Editors POV ???

  1. First start your editor
  2. Enable the DEV-MODE (developers-mode) inside your Wix-Editor.
    Now you have the view from developers POV.
  3. To be able to insert your wished functionality, you will have to add a CUSTOM-ELEMENT. As i can see, you already worked with custom-elements, so you will have already some experience in the usage of them and surely you will also have some HTML and CSS knowledge.

Use the SEARCH of VELO-FORUM and find related articles. There are a lot of them already. They will lead you to the right direction. A assume you are already an experienced coder → so you will find your SOLUTION.