contenteditable-max-length

Sets the maximum number of characters that can be entered in the contenteditable element

Usage no npm install needed!

<script type="module">
  import contenteditableMaxLength from 'https://cdn.skypack.dev/contenteditable-max-length';
</script>

README

contenteditable-max-length

Set the maximum number of characters that can be entered in the contenteditable element

Getting started

npm install contenteditable-max-length --save-dev

Syntax

const unsubscribe = contenteditableMaxLength([options])

Options

element
DOM contenteditable element

maxLength
Number of maximum characters

Return value

The unsubscribe function

Usage example

import contenteditableMaxLength from 'contenteditable-max-length'

const unsubscribe = contenteditableMaxLength({
  element: document.getElementById('contenteditable-element'),
  maxLength: 100
})