Topic: Cannot read properties of null (reading 'classList') when using Input.getOrCreateInstance(inputElement);

Somebody pro asked 1 day ago


Hi,

I load the content of my modal asynchronously like there, within my modal something similar to this :

<div class="form-outline" data-mdb-input-init>
  <input type="text" id="test" class="form-control" />
  <label class="form-label" for="test">Example label</label>
</div>

const inputElement = modalBodyElement.querySelector('#test');
if (inputElement instanceof Element)
    Input.getOrCreateInstance(inputElement);

This case provokes the following error: Cannot read properties of null (reading 'classList')



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 9.2.0
  • Device: desktop
  • Browser: brave
  • OS: linux
  • Provided sample code: No
  • Provided link: Yes