IFrame focus

by Michelle Bu

HTML

<div>
Focus on the input element in Mobile Safari, then on the iframe:
<input />
<iframe src="https://jsfiddle.net/user/mchl/fiddles/" frameborder="0"  scrolling="no" allowtransparency="true"></iframe>
</div>

<div>
<br />
The currently focused node name is: 
<strong><span class="NodeName"></span></strong>
</div>

CSS

iframe {
  width: 50px;
  display: block;
  height: 50px;
  margin-top: 10px;
}
input {
  width: 50px;
  display: block;
  height: 50px;
  box-sizing: border-box;
}

input:focus {
  border: 3px solid blue;
}

JavaScript

setInterval(function() {
	document.querySelector('.NodeName').innerHTML = document.activeElement.nodeName;
}, 200);