Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

div contenteditable maxlength reactjs

const maxLength = 12
const onKeyDwn = (e: any) => {
        const currentTextLength = e.target.outerText.length;
        if (currentTextLength === maxLength && e.keyCode != 8) {
            e.preventDefault();
        }
}


<div onKeyDown={onKeyDwn} contentEditable={true} ></div>
Comment

PREVIOUS NEXT
Code Example
Typescript :: ion popover pass data 
Typescript :: nodemon.ps1 cannot be loaded because running scripts is disabled on this system. 
Typescript :: how to use typescript on createRoot 
Typescript :: replace all br tags within node with paragraph opening and closing tags 
Typescript :: scroll to top angular 
Typescript :: measurement technique of total fiber attenuation gives 
Typescript :: installing bootstrap in angular 9 
Typescript :: ionic save base64 as file 
Typescript :: throw error in typescript 
Typescript :: nestjs ratelimit 
Typescript :: how to view documents folder simulator swift 
Typescript :: add elements to middle of array using splice 
Typescript :: nodejs jszip create zip file as buffer 
Typescript :: No type arguments expected for interface ListAdapter 
Typescript :: how to get value_counts output in dataframe format 
Typescript :: sql server results to comma delimited string 
Typescript :: angular change how date looks 
Typescript :: what is test management review 
Typescript :: remove duplicates from array angular 
Typescript :: angular unsubscribe from observable 
Typescript :: typescript cannot find name console 
Typescript :: typescript type from enum values 
Typescript :: Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk/cmdline-tools/latest/ 
Typescript :: wordpress query to get posts by post meta 
Typescript :: promise.all does not wait 
Typescript :: react typescript onclick type 
Typescript :: Angular 6 checkbox checked dynamically 
Typescript :: check runnong ports ubuntu 
Typescript :: declare jquery in typescript 
Typescript :: npm clean 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =