Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14238 closed bug (notabug)

It consoles up to parent level.

Reported by: bharat20185@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

I used jQuery 1.10.2 i.e CDN url.

I have made "UL LI" tree view and make li clickable to get path but whenever I click on any LI dom it gives all DOM up to its parent. See below code I wrote.

<ul class="root">

<li>Root

<ul>

<li class="dir1">Dir 1

<ul>

<li>Sub Dir 1</li> <li>Sub Dir 2</li>

</ul>

</li> <li class="dir2">Dir 2

<ul>

<li>Sub Dir 1</li> <li>Sub Dir 2</li>

</ul>

</li> <li class="dir3">Dir 3

<ul>

<li>Sub Dir 1</li> <li>Sub Dir 2</li>

</ul>

</li> <li class="dir4">Dir 4</li>

</ul>

</li>

</ul> <script>

$(document).ready(function () {

jQuery('li').click(function(obj){

console.log(obj);

})

});

</script>

Change History (1)

comment:1 Changed 6 years ago by dmethvin

Resolution: notabug
Status: newclosed

Event bubbling, learn it. Ask for help on a forum.

Note: See TracTickets for help on using tickets.