Reset character counter thru api (or programmatically)


Topic: Reset character counter thru api (or programmatically)

Huichofer pro asked 2 years ago

After creating an input with character counter, if I delete the text of the field thru javascript (or jquery), the counter doesn't go back to 0. Is there a way to reset the counter back to 0/N? I mean other than manipulating the counter text directly by myself. Thanks


Grzegorz Bujański staff answered 2 years ago

Character counter is updated on input event . You have to trigger it after clearing the value. Also add an trigger blur to make the label go down.

https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/4122727#js-tab-view


Huichofer pro commented 2 years ago

That did the trick. Thank you !


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 4.2.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No