JSFiddle - React, Tailwind, and code Playground

by cmruser

HTML

<select>
  <option>select</option>
  <option>test</option>
</select>

JavaScript

var nav = [{name: 'test'}, {name: 'a'}];

const ids = nav.reduce((acc, item, index) => {
	const key = item.name.toLowerCase();
    return { ...acc, [key]: index }
}, {});

console.log(nav[ids['a']]);

const s = '/sales';
const url = s.substring(1).split('/');
console.log(url);


function isKeyPressed(event) {
  if (event.shiftKey) {
    console.log("The SHIFT key was pressed!");
  } else {
    console.log("The SHIFT key was NOT pressed!");
  }
}



$('select').on('change click',(e) => {
     e.preventDefault();
     e.stopPropagation();
     //isKeyPressed(event);
     
   setTimeout(function(){
  	$('select').trigger('click');
   }, 1);
     isKeyPressed(event);
   
 });