> 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

# Method name: link()

# Method package: w

# Method menu location: w --> TextMask --> link

# Method Link: https://dev.wix.com/docs/velo/velo-only-apis/$w/text-mask/link.md

# Method Description:

Sets or gets the element's link.

When the element is clicked, the browser navigates to the `link` location.

 The different types of links you can use are:

 + `/localPageURL`: another page on your site
 + `/`: your site's home page
 + `http(s)://`: an external web address
 + `wix:document://`: a document stored in the Media Manager
 + `mailto:?subject=`: an email
 + `tel:`: a phone number


 The `link` property attempts to properly encode the URL value that
 you set. For example, `.../some page` is encoded to `.../some%20page`.
 However, some URLs do not have one unambiguous encoding. In those cases
 it is up to you to encode the URL to reflect your intentions. Because of
 these situations, it is a best practice to always encode URLs before you
 set them as the value of the `link` property. Regardless of how you set
 the `link` property, when you get its value, it returns an encoded URL.

 Note that Wix URLs do not contain spaces. A page which has spaces in its
 name has its spaces replaced with dashes (`-`). Similarly,
 a [dynamic page URL](https://support.wix.com/en/article/creating-a-unique-dynamic-page-url) which 
 contains the value of a field in your collection with spaces
 has its spaces replaced with dashes (`-`).



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get the link URL from an element

```javascript
let url = $w("#myElement").link;   // "http://mysite.com"
```

## Set an element to open a local link

```javascript
$w("#myElement").link = "/about-me";
```

## Set an element to open an external web link

```javascript
$w("#myElement").link = "http://wix.com";
```

## Set an element to open an external web link in a new browser page when clicked

```javascript
$w("#myElement").link = "http://wix.com";
$w("#myElement").target = "_blank";
```

## Set an element to open a new email window when clicked

```javascript
$w("#myElement").link = "mailto:a@b.com?subject=Something%20Interesting";
```

## Set an element to open a document

```javascript
$w("#myElement").link = "wix:document://v1/9bec_52fb06ea/filename.xls";
```

## Set an element to make a phone call when clicked

```javascript
$w("#myElement").link = "tel:+1-555-555-5555";
```

---