document.querySelector('#adbox').onclick = function() {
this.style.display = 'none';
};
<div id="adbox"> ad code goes here </div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div id="adbox"> ad code goes here </div>
$('#adbox').on('click', function() {
$(this).hide();
});