> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Copying and Deleting Coded Sites, Pages, and Elements

## Article: Copying and Deleting Coded Sites, Pages, and Elements

## Article Link: https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/overview/copying-and-deleting-coded-sites-pages-and-elements.md

## Article Content:

# Managing Coded Sites, Pages, and Elements

When working on a Wix site with code, it's important to understand how duplication and deletion affect your site's functionality. Whether you're copying an entire site, a page, or an individual element, or deleting elements with connected code, the outcome depends on how your code is structured and wired.

## Duplicating pages and sites

You can duplicate [sites](https://support.wix.com/en/article/duplicating-your-site-1472847) and [pages](https://support.wix.com/en/article/wix-editor-managing-your-sites-pages), as well as [clone](https://support.wix.com/en/article/wix-studio-managing-sites-in-a-workspace) and [transfer](https://support.wix.com/en/article/transferring-a-free-site-to-another-wix-account) your Wix sites. Whether you're duplicating a single page, an entire site, or cloning or transferring a site, the code and events are maintained in the new version.

## Duplicating elements

When you copy and paste an element that has associated code, the element itself is duplicated, but any events, wiring, or code linked to it aren't included.

<blockquote class="important">

**Important:** If you're building a Wix site that others can edit, make sure they understand the limitations of working with elements. For more information, see [Working with Collaborators](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/overview/working-with-collaborators.md).

</blockquote>

## Deleting elements

When you delete elements from your site, the behavior of any associated code depends on the type of event handler used — static or dynamic. In both cases, the code itself isn't automatically removed, but how it's connected to the element changes.

>**Note:** In the editor, if a collaborator tries to delete elements referenced by code, a confirmation prompt displays. The prompt helps prevent accidental deletions that can impact your code. The prompt displays for:
>
>- Elements directly referenced by code. A ![code](https://wixmp-833713b177cebf373f611808.wixmp.com/images/061bba0b7714af979fc4343df936a412.png) icon displays for these elements as an indicator.
>- Parent elements whose nested elements are referenced by code.

### Deleting an element with dynamic event handler

When you delete an element with a [dynamic event handler](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/frontend-code/about-event-handlers-in-wix.md), the associated code isn't removed. If you add a new element and give it the same ID as the deleted one, the existing code will continue to work as expected.

### Deleting an element with static event handler

When you delete an element with [static event handler](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/frontend-code/about-static-event-handlers.md), the associated code remains, but the event wiring is removed. For example, you have an element named `button2` with an `onClick` event that toggles the visibility of an element called `image3`:

```javascript
export function button2_onClick(event) {
    if ($w("#image3").visible) {
        $w("#image3").hide();
    } else {
        $w("#image3").show();
    }
}
```

If you delete `button2` from your page, the event code is not deleted. However, the event is no longer wired. This means that if you add a new button and name it `button2`, the code above won't run when it's clicked, you would need to rewire the event manually.

## See also

- [About Code Placement](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/overview/where-do-i-put-my-code.md)
- [Working with Collaborators](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/overview/working-with-collaborators.md)