Topic: Material Select tab index

stcolettawi pro asked 4 years ago

I am trying to use a searchable material select field in my form.  How do I make the search field be where the tab key places focus when tabbing through a form?  When you tab through the form now it activates the select list displaying all of the choices and the search field, but if you try to just start typing nothing happens.  I would like it to put the focus in the search field so that you can just start typing what you want to find.

Mikołaj Smoleński staff answered 4 years ago

Hello, For this moment I suggest to add the following code to our mdb.js file: $('.search').focus(); It should be added in this section: // Show dropdown activates.stop(true, true).css('opacity', 0).slideDown({ queue: false, duration: options.inDuration, easing: 'easeOutCubic', complete: function complete() { $(this).css('height', ''); } }).animate({ opacity: 1, scrollTop: 0 }, { queue: false, duration: options.inDuration, easing: 'easeOutSine' }); $('.search').focus(); } Regards

stcolettawi pro commented 4 years ago

That works perfectly. Thanks

Please insert min. 20 characters.


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



Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No