Where is this JQuery wrong?

I want to add the click event to all elements where the `id="violacao": $(document).ready(function () { jQuery('#violacao').click(function() { alert('teste'); }); }); But just the first link responds to the click. This is the HTML generated: 40954589 Perda de Comunicação 88692020503 Perda de Comunicação When I try this way: jQuery("a").click(function() { alert('teste'); }); It works fine, except that all links are affected. What is wrong?

以上就是Where is this JQuery wrong?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准