id search works only for first element

后端 未结 2 1422
南旧
南旧 2021-01-17 06:41

I have a block:

2条回答
  •  Happy的楠姐
    2021-01-17 07:27

    I'm not sure exactly what behavior you're looking for, but posting your code unchanged to http://jsfiddle.net/CrossEye/hApgg/, I seem to get it working consistently for all three links.

    I don't know why you write the parentheses wrapping the "a" below:

    $(("a"),local_links).on("click", function(e){ //...
    

    This would work equally well:

    $("a", local_links).on("click", function(e){ // ...
    

    but they're not hurting anything either.

    So does this Fiddle duplicate your problem? If not, then the problem is in code other than what you've posted.

提交回复
热议问题