Jquery help needed- infinite loop?
        Posted  
        
            by ilkin
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ilkin
        
        
        
        Published on 2010-04-26T08:10:44Z
        Indexed on 
            2010/04/26
            8:13 UTC
        
        
        Read the original article
        Hit count: 238
        
jQuery
|JavaScript
Hi all, i have a problem with this code:
    var par = [];
    $('a[name]').each(function() {
        if (($(this).attr('name')).indexOf("searchword") == -1) {
            par.push($(this).attr('name'));
            $('.content').empty();
            for (var i = 0; i < par.length; i++) {
                $(".content").append('<a id="par" href="#' + par[i] + '">' + par[i] + '</a><br />');
            }
        }
    });
It causes ie and firefox to popup the warning window "Stop running this script". But it happens only when there is a very very large amount of data on page. Any ideas how to fix it?
© Stack Overflow or respective owner