Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get focusable elements

/**
 * 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'))
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: diff in javascript 
Javascript :: sort in javascript array 
Javascript :: send mail, nodemailer, nodemailer, mailer, nodemailer npm 
Javascript :: react usereducer 
Javascript :: javascript redirect with extra url arguments 
Javascript :: addition of all elements of array in js 
Javascript :: gql TypeError: Object(...) is not a function 
Javascript :: js date in two weeks 
Javascript :: javascript dump strack trace 
Javascript :: how to minimize electron app to tray icon 
Javascript :: regex start line 
Javascript :: jshint ignore 
Javascript :: set cookie using nest js 
Javascript :: javascript MIN_VALUE 
Javascript :: jsonwebtoken error with react js 
Javascript :: javascript slice vs splice 
Javascript :: javascript remove element from object 
Javascript :: remove special characters in javascript 
Javascript :: how to append data to a field in mongoose model 
Javascript :: mysql json_array_append 
Javascript :: print chart js 
Javascript :: how to disable and enable a button in jquery 
Javascript :: return a date time object in yyyy-mm-dd hr:min:sec 
Javascript :: why does my form reload the page? html js 
Javascript :: react context 
Javascript :: js create p element with text 
Javascript :: js remove last character 
Javascript :: get background image url jquery 
Javascript :: date js add days 
Javascript :: reverse method 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =