Stackoverflow Answer

http://stackoverflow.com/questions/23814025/javascript-error-element-is-null/23814074

HTML

<div class="wrapper" id="tileBlock" onclick="alert('You clicked (inline)')"></div>

CSS

#tileBlock {
    position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background-color: #0b0b0b;
        background-position: center;
        background-repeat: no-repeat;
        background-image: url(photo.jpg);
        border: 20px solid #fff;
        background-size: cover;  
    }

    @media (max-width: 400px) {
      #tileBlock {
        border-width: 8px;
      }
    }

JavaScript

var tileBlock = document.getElementById('tileBlock');
//tileBlock.onclick = function() {
    //alert('you clicked(external script)');
//}