function hasClass(element, className) { var classList = element.className.split(" "); return classList.some(function (name) { return name === className; }); }
( function ( $ ) { $( document ).on( 'click', '.div', function() { if ( $( this ).hasClass( 'house' ) ) { $( this ).removeClass( 'house' ); } } ); } ( jQuery ) );
document.addEventListener('click', function(e) { var el = e.target; if (el.classList.contains('house')) el.classList.remove('house'); });