You need to sign in to do that
Don't have an account?
Jennifer Prather
Input Rich Text Counter
I was trying to add a counter to an input rich text lightning web component. I can get it to display the character count but cannot get it to count down. I was getting an error saying the counter variable I called was not being used as well as the maxlength.
<template> <lightning-input-rich-text type="text" value={value} maxlength="100"> </lightning-input-rich-text> <span id="counter">100</span> </template>
/* eslint-disable no-unused-vars */ import { LightningElement, track, api } from 'lwc'; export default class InputRichText extends LightningElement { @api value; @track value; itemsChange(_oninput){ let counter = this.getElementById("counter"); let maxlength = this.getAttribute("maxlength"); counter.textContent = maxlength - this.value.length; } }