Topic: How to update showcounter when value is set by js?

METOURNEAU free asked 10 months ago


Expected behavior The counter is updated when js set value to the input.

Which event should be called?

Actual behavior The counter is not updated when js set value to the input

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/metourneau/5516150#js-tab-view

Thanks


Grzegorz Bujański staff answered 10 months ago


Try this:

const input = document.getElementById("textcount");
input.value = 'test'
const event = new Event('input');

input.dispatchEvent(event);


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: hp
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes