Menu field is not closing, when clicked on menu <p>I have one question with my code.</p> <p>I have created this <strong><a href="http://jsfiddle.net/mustafaozturk74/b6rhxaxd/10/">DEMO</a></strong> from jsfiddle.net</p> <p>When you click the red div then the menu will opening but if you click the menu items the menu area will not closing. </p> <p>What do i need to close the menu area when clicked the menu?</p> <pre><code>&lt;div class="p_change" tabindex="0" id="1"&gt; &lt;div class="pr_icon"&gt;&lt;div class="icon-kr icon-globe"&gt;&lt;/div&gt;CLICK&lt;/div&gt; &lt;div class="pr_type"&gt; &lt;div class="type_s change_pri md-ripple" data-id="0"&gt;&lt;div class="icon-pr icon-globe"&gt;&lt;/div&gt;1&lt;/div&gt; &lt;div class="type_s change_pri md-ripple" data-id="1"&gt;&lt;div class="icon-pr icon-contacs"&gt;&lt;/div&gt;2&lt;/div&gt; &lt;div class="type_s change_pri md-ripple" data-id="2"&gt;&lt;div class="icon-pr icon-lock-1"&gt;&lt;/div&gt;3&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="p_change" tabindex="0" id="2"&gt; &lt;div class="pr_icon"&gt;&lt;div class="icon-kr icon-globe"&gt;&lt;/div&gt;CLICK&lt;/div&gt; &lt;div class="pr_type"&gt; &lt;div class="type_s change_pri md-ripple" data-id="0"&gt;&lt;div class="icon-pr icon-globe"&gt;&lt;/div&gt;1&lt;/div&gt; &lt;div class="type_s change_pri md-ripple" data-id="1"&gt;&lt;div class="icon-pr icon-contacs"&gt;&lt;/div&gt;2&lt;/div&gt; &lt;div class="type_s change_pri md-ripple" data-id="2"&gt;&lt;div class="icon-pr icon-lock-1"&gt;&lt;/div&gt;3&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>JS</p> <pre><code>$(document).ready(function() { $('.pr_icon').on('click',function(e){ // Change Post Privacy $('.change_pri').on('click',function(event){ event.stopPropagation(); var dataid = $(this).attr('data-id'); var id = $(this).closest('.p_change').attr('id'); var class_name = $(this).find(".icon-pr").attr("class"); class_name = class_name.replace(/icon\-pr\s+/gi, ""); $(this).closest(".p_change").find(".icon-kr").removeClass().addClass("icon-kr " + class_name); $.ajax({ type: "POST", url: "change_id.php", data: { dataid : dataid, id: id } }).success(function(html){ if (html.trim() === "1") { // Do Something } else { // Do something } }); }); }); </code></pre>