selecting dom elements after html was inserted in a page with ajax

前端 未结 2 1199
野趣味
野趣味 2020-12-30 10:31

I created an ajax tab navigation with html being inserted into the page. the code looks like this:

$.ajax({
        type: \'POST\',
        url: \'main/ajaxj         


        
2条回答
  •  独厮守ぢ
    2020-12-30 10:55

    Run this once, after the page's first load.

    $("body").delegate('#chapters-select','change', function(){
        alert('changed');
    });
    

    It's equivalent to @gdoron's answer, but is compatible with versions of jQuery older than 1.7

提交回复
热议问题