Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

how to set element as focusable javascript code example

Example 1: html how to make element focusable

Click to copy
tabindex="0"

Example 2: javascript get focusable elements

Click to copy
/**
 * Gets keyboard-focusable elements within a specified element
 * @param {HTMLElement} [element=document] element
 * @returns {Array}
 */
function getKeyboardFocusableElements (element = document) {
  return [...element.querySelectorAll(
    'a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
  )]
    .filter(el => !el.hasAttribute('disabled'))
}

Tags:

Html Example

Related

df.to_csv index false code example git reset my branch code example python vowels string code example Error: no pg_hba.conf entry for host user database SSL off code example java static attribute code example stop postgresql windows code example call post api through axios react code example global variables prestashop 1.7 code example how to call Carousel function in javascript code example $(document).ready(function () meaning code example appending a list to a list code example how to uninstall python packages in windows code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy