apply plugin to a new element in the DOM (jquery)

后端 未结 4 771
故里飘歌
故里飘歌 2020-12-12 01:23

I am using the jquery tablesorter plugin and applies it to a table with id : #table

my search facility requests for results via ajax and replaces the table with a ne

4条回答
  •  旧巷少年郎
    2020-12-12 01:35

    you have to re-run $('#table').tablesorter(); after search request completed.

    $.ajax({
     type: "POST",
     url: "search.php",
     data: "query=blabla",
     success: function(html){
    
        // replace old table with new table
    
        // re-apply table sorter
        $('#table').tablesorter();
    
     }
    

    });

提交回复
热议问题