I am facing an issue about this.
<div id="1">
    <div id="2">
    </div>
    <div id="3">
        <div id="4">
        </div>
    </div>
</div>
<div id="others_div">
</div>
I want to add the class "hidden" to "1" when I click on something which is not "1" nor one of its children.
Now I am using this but I have a lack of imagination for solving this issue...
document.onclick = function(e)
{
    if(e.target.id!="1")
    {
        $("#1").addClass("hidden");
    }
}
 
     
     
     
     
    