Call jquery function when
    content change

前端 未结 7 782
遇见更好的自我
遇见更好的自我 2021-01-17 08:40

I try to call jQuery function when ul content is changed.

Below is my code

JS

jQuery(document).ready(function($) {

        $(\'.ProductList\         


        
7条回答
  •  死守一世寂寞
    2021-01-17 09:42

    You can use setInterval(funcName, 1800) Check List each 1/2 second if ProductList is changed

    Example jsfiddle

    HTML

    JS

        function handleProductList(){
            if(jQuery('ul.ProductList > *').size() !=="undefined"){
            var ProductListNum = jQuery('ul.ProductList > *').size();
                console.log(ProductListNum);
            }
        }
    
        /* Check List each 1/2 second */
        setInterval("handleProductList();", 1800);
    

提交回复
热议问题