Getting access to a jquery element that was just appended to the DOM

后端 未结 7 836
耶瑟儿~
耶瑟儿~ 2020-12-08 18:34

I am simply appending an element that is on the DOM like:

$(\"#div_element\").append(\'test\');

Right after I

7条回答
  •  不思量自难忘°
    2020-12-08 19:06

    Add identity to that element then use it as follows

    $("#div_element").append('test');
    
    
    $('#tester').on('click', function(event) {
    console.log('tester clicked');
    });
    

提交回复
热议问题