<!-- Styled div -->
<div
role="button"
onkeyup="if(event.keyCode==13||event.keyCode==32){performAction()};"
onclick="performAction();"
tabindex="0">Perform action</div>
<!-- Button -->
<button
type="button"
onclick="performAction();">Perform action</button>
div{
background: buttonface;
width: 100px;
border: 1px solid #fff;
padding: 5px;
}
window.performAction = alert.bind(this,"Action");
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.