Access jQuery function from page elements generated in jQuery

I have a little jQuery call that returns perfectly for my element bound to an on function: $(".claim-detail a").on("click", function(){ ...some stuff }) Then a little html:

get the data

Works perfectly. But I need that claim-detail html to be generated in javascript. And when I move it there, the html is generated on the page with no problem, but the jQuery function breaks entirely . Doesn't matter which piece precedes which in the javascript. Anything I'm doing obviously wrong?
Without the your code we cannot say what you are doing wrong. You have to create and add the elements before you bind the event handler. Then it will work.

以上就是Access jQuery function from page elements generated in jQuery的详细内容,更多请关注web前端其它相关文章!

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

评论 抢沙发

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

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