---
title: "Valid elements example"
description: "This example shows you how to use the extended_valid_elements option, enabling you to specify valid elements and attributes."
canonical_url: "https://www.tiny.cloud/docs/tinymce/5/valid-elements/"
md_url: "https://www.tiny.cloud/docs/tinymce/5/valid-elements/index.md"
version: "5"
last_updated: "2024-03-26T08:09:19Z"
tokens: 175
---
Important This page documents TinyMCE 5. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/).
# Valid elements example

This example shows you how to use the [extended_valid_elements](../content-filtering/#extended_valid_elements) option. This option enables you to specify valid elements and attributes.

**Example**

```js
tinymce.init({
  selector: 'textarea#valid-elements',
  plugins: 'code',
  height: 500,
  extended_valid_elements: 'img[class=myclass|!src|border:0|alt|title|width|height|style]',
  invalid_elements: 'strong,b,em,i',
  content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
});
```
