I ran inro a problem recently which i haven't found any solution to.
i generated a subnode for all unordered lists which are Childs of List-Elements like this:
- <ul>
- <li>1</li>
- <li>2
- <ul>
- <li>2.1</li>
- <li>2.2</li>
- </ul>
- </li>
- <li>3</li>
- </ul>
The generated list works fine and looks like this:
- 1
- 2
- 2.2
- 2.2
- back <-Generated Element <li class="back">back</li>
- 3
but if I click the Back button the Event fires twice (or the function runs twice)
- $("li").click(function(e){
- alert("in");
- if($(this).is('.back')) {
- alert("back");
- }else{
- $(this).parent().children().hide();
- $(this).show();
- $(this).children().show();
- alert("li clicked");
- }
- });
Click on back:
in
back
in
li clicked
on others:
in
li clicked
Thanks in advance
Fiisch0r