{"id":1232,"date":"2013-06-05T14:54:40","date_gmt":"2013-06-05T05:54:40","guid":{"rendered":"http:\/\/www.santoshkori.com\/blog\/?p=1232"},"modified":"2013-06-05T14:54:40","modified_gmt":"2013-06-05T05:54:40","slug":"how-to-add-jquery-parent-and-child-click-events","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/how-to-add-jquery-parent-and-child-click-events\/","title":{"rendered":"How to add jQuery Parent and Child Click events"},"content":{"rendered":"<p>Here is &lt;LI&gt; Tag and inside that there is anchor link tags &lt;A&gt;, so how we can make jQuery click event on both parent and child element.<\/p>\n<p>here is code<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n$(&quot;li&quot;).click(function(e) {\r\n   alert(&quot;Clicking on the li will trigger this, not the &lt;a&gt; children&quot;);\r\n});\r\n\r\n$(&quot;li a&quot;).click(function(e) {\r\n   e.stopPropagation(); \/\/ The img children inside li will not trigger the li event.\r\nalert(&quot;Clicking on the li will trigger this, not the &lt;a&gt; children&quot;);\r\n});\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is &lt;LI&gt; Tag and inside that there is anchor link tags &lt;A&gt;, so how we can make jQuery click event on both parent and child element. here is code $(&quot;li&quot;).click(function(e) { alert(&quot;Clicking on the li will trigger this, not the &lt;a&gt; children&quot;); }); $(&quot;li a&quot;).click(function(e) { e.stopPropagation(); \/\/ The img children inside li will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[594,595,596],"class_list":["post-1232","post","type-post","status-publish","format-standard","hentry","category-jquery","tag-how-to-add-jquery-parent-and-child-click-events","tag-jquery-parent-and-child-click-events","tag-parent-and-child-click-events"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=1232"}],"version-history":[{"count":1,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1232\/revisions"}],"predecessor-version":[{"id":1233,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1232\/revisions\/1233"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=1232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=1232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=1232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}