Topic: Adding select dynamically

dagaey free asked 1 year ago


When adding a select with a label dynamically, the label initially does not have a white background so that the label is with a line behind it. This is fixed as soon as the select receives focus.

I tried using

new mdb.Input(formOutline).update();

but this generated the following error:

cannot read properties of null (reading 'classList')
    at Object.addClass (manipulator.js:98:17)
    at g._showPlaceholder (input.js:187:17)
    at g._getLabelData (input.js:130:12)
    at g.init (input.js:77:10)
    at new g (input.js:56:12)
    at index.html:1920:3
    at NodeList.forEach (<anonymous>)
    at clickslot (index.html:1919:41)
    at HTMLDivElement.onclick (index.html:1:1)

Kamila Pieńkowska staff answered 1 year ago


I've updated the snippets I've made for you yesterday: https://mdbootstrap.com/snippets/standard/kpienkowska/5196028


dagaey free commented 1 year ago

I created a snippet for multiple dynamic inputs with multiple field types - please let me know if this is correct. also please look at the issue with the select which is not the same width of the other fields.

https://mdbootstrap.com/snippets/standard/dagaey/5209213


Kamila Pieńkowska staff commented 1 year ago

If they work then it is correct. There are multiple ways to achieve that.

I've edited your code to remove padding for select. https://mdbootstrap.com/snippets/standard/kpienkowska/5215486



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 6.2.0
  • Device: desktop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No