How can I call a function after an element has been created in jquery?

前端 未结 9 2141
野趣味
野趣味 2020-12-28 13:37

I want to call a function after an element has been created. Is there a way to do this?

Example:

$(\"#myElement\").ready(function() {
    // call the         


        
9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 14:18

    check out .live() its best after the element created,,

    $('.clickme').live('click', function() {
          // Live handler called.
    });
    

    And then later add a new element:

    $('body').append('
    Another target
    ');

提交回复
热议问题