.remove() is not a function

I am getting error .remove() is not a function.

document.getElementById("lorem").onsubmit = async (event) => {
  // Prevent the default form submission behavior, which would reload the page
  // Get the currently selected element in the Designer
  const el = await webflow.getSelectedElement()

  if (el) {
  await el?.remove();
} else {
  console.log("No element is currently selected.");

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

Hi @toqeer.94! Do you mind providing a few details here?

  1. Are you using v2 Designer APIs (should be dictated by the apiVersion in webflow.json)?
  2. Do you mind testing to see if the remove() error is surfacing on other Webflow elements on your site? If not, do you mind providing more details around what kind of element is surfacing this error when you call remove()?

Hello @zachplata


  "name": "mrs-app",
  "version": "1.0.0",
  "private": true,
  "main": "index.js",
  "scripts": {
    "build": "npm install && tsc -p tsconfig.json && webflow extension bundle",
    "dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\""
  "devDependencies": {
    "@webflow/designer-extension-typings": "^0.2.0-beta.3",
    "concurrently": "*",
    "typescript": "*"


  "name": "mrs-app",
  "publicDir": "public",
  "size": "default"

I have tested remove() on heading, button and para etc, but still getting same error.

I have also console.log(el) i am getting element id.

other then .remove(). every function is working fine. Only this function is not working.

Thanks for the details @toqeer.94 - it looks like you may be using v1 of the Designer API. I would add the following in your webflow.json to use v2 Designer APIs (which will allow you to call .remove() on your selected element). This will inject the appropriate script in your app to utilize the newer APIs that correlate with the API docs. See more here: Migrating to v2

  "name": "mrs-app",
  "publicDir": "public",
  "size": "default",
  "apiVersion": "2"

Hope this helps!

1 Like