Edit in JSFiddle

var settings = document.getElementById('settings');
document.onclick = function(e){
    var target = (e && e.target) || (event && event.srcElement);
    var display = 'none';
    
    while (target.parentNode) {
        if (target == settings) {
            display ='block';
            break;
        }
        target = target.parentNode;
    }

    settings.style.display = display;
}
<div id="settings">
<input/><select></select><span>text</span>
</div>