tabindex="0"
)$('.btn').keypress(function(e){goober});
role="button"
)It would have been a lot easier to just use a button
, no?
<div role="button" tabindex="0" class="btn fake-btn" style="border:1px solid #ccc;background:#eee">A "button"</div>
<script type="text/javascript">
$('.btn').on('click', function() {
alert('you clicked me')
});
$('.btn').keypress(function(e){
if(e.which===13){
alert('pressed enter');
} else {
if(e.which===32){
alert('pressed spacebar');
}
}
});
</script>