Not able to set focus on a form field on a modal


Topic: Not able to set focus on a form field on a modal

triklimops-org pro premium priority asked 3 years ago

Expected behavior Open a modal and choose a field I want to set focus, the input field would have the focus.

Actual behavior The input field does not have the focus even though I set it in the code on display of the modal

Resources (screenshots, code snippets etc.)

const modalElement = document.getElementById('my-modal') const myModal= new mdb.Modal(modalElement ) myModal.show()
$("#field-id").focus();


Mikołaj Smoleński staff commented 3 years ago

Do you have any errors in the console? Are you sure the code is correct and dedicated for you version of UI KIT (MDB4 4.20.0 jQuery)? Can you recreate the issue in our snippets generator? https://mdbootstrap.com/snippets

Keep coding!


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Open

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: MDB4 4.20.0
  • Device: Computer
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags