Search code examples
javascriptjquerylivequery

jquery. livequery() strange behavior


trying to run jquery plugin "livequery" to highlight some words in a dynamically generated search results doesn't work ! However adding an alert() function before excuting the code make the highlighting appear! so what is the problem?

$(document).ready(function(){     
     $('#searchResults').livequery(function(el){
     // alert('test');
     $( '#searchResults' ).highlight( highlightArray );
 });
});  

Solution

  • Can you try adding some delay by setTimeout()

    $(document).ready(function(){     
         $('#searchResults').livequery(function(el){
             // alert('test');
             setTimeout(function(){
                 $( '#searchResults' ).highlight( highlightArray );
             },400);
         });
    });