Home > front end >  With ajax Mosaic li, and give each li binding the onclick event, only take effect once, click the se
With ajax Mosaic li, and give each li binding the onclick event, only take effect once, click the se

Time:10-15

SecondLable +='& lt; Li & gt; All & lt;/li> '
For (var j=0; JSecondLable +='& lt; Li menuId="' + secendMenu [j]. J menuId + '" onclick=" showThiredMenu () "& gt; '+ secendMenu [j] menuName +' & lt;/li> '

}
The above is my with ajax patchwork li, why showThiredMenu () the implementation of this method, click the second failure, should be how to write? Hope bosses to answer!!!!!!

CodePudding user response:

$(" # ") on (' click ', function (event) {});

Use this way to bind the event to try

CodePudding user response:

$(" # id "). Click (function () {

$(" # id li "). Each (function () {


})
})
With each

CodePudding user response:

Has now been solved, the first solution to tie, the binding click event

CodePudding user response:

Is big, just a question, a moment is solved

CodePudding user response:

Binding before the click event don't need the tie,,
It must be other causes

CodePudding user response:

Don't need to try this solution to events, I live not to eat xiang: $(document) on (" click ", "# id li", function () {}).

CodePudding user response:

6th floor big ah, thank you very much
  •  Tags:  
  • Ajax
  • Related