How to know all elements of the block to which the jquery function has not been applied hide(s)



  • I do this:

        var total = 0;
        $(this).closest('ul').find('.item-price').each(function(){
            if($(this).css('display')=='visible') {
                total = total + Math.round($(this).find('span').text());
                console.log(total);
            }
        });
    

    But nothing works:



  • Try it. :visible

        var total = 0;
        $(this).closest('ul').find('.item-price:visible').each(function(){
                total = total + Math.round($(this).find('span').text());
                console.log(total);
        });
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2