JSFiddle - React, Tailwind, and code Playground

by Sachin Patel

HTML

<button id="button" onclick="clickSample();">Click Me!</button>
<div id="sampleDiv" tabindex="121" onblur="alert('This one has tabindex');"></div>

CSS

#sampleDiv {
  width: 200px;
  height: 200px;
  background: yellow;
}

JavaScript

document.getElementById('button').focus();
 
function clickSample(){
	console.log('click');
	document.getElementById('sampleDiv').focus();
	console.log(document.activeElement.tagName)
}