javascript - How do I know which <li> element was clicked from a <ul>? -
I have Each So when I took one Clicking on the image goes to div, but I want to know which index is taken (1,2,3,4,5, etc.). & lt; Ul & gt;
, and every & lt; Li & gt; The background of
is 50px * 50px but I want to know which code is
& lt; Li & gt;
has an image, therefore, when I
another & lt; Div & gt;
, but when I want to change the image I wanted to know, click on which was clicked.
$ ("# ul element"). ("Click", "li", (function () {$ ($ ("# theediv"). $ ("# Thediv") empty (). App ('
You can use the following to get the current index in the list
$ (this). Index (); < / Code>
Comments
Post a Comment