[英]Assigning on click events to dynamic element using one
I am building a form that submits quantity dynamically. 我正在建立一个动态提交数量的表格。
the problem I am having is maintaining the click events on freshly loaded rows. 我遇到的问题是在新加载的行上维护click事件。 I would like the 'one' event to be reassigned after each submission. 我希望在每次提交后重新分配“一个”事件。 I currently have: 我目前有:
$(this).one('click',function(e){
To allow for delegating new DOM elements, I think it needs to look a little like: 要允许委派新的DOM元素,我认为它需要看起来有点像:
$(document).one('click',this,function(e){
But I can't make that work 但是我做不到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.