Visible & First/Last Occurrence

Visible & First/Last Occurrence

I'm trying to look at searchercustomcontent that are visible (some may have display:none applied) and then make sure it's parent is visible and then apply margin to parent first occurrence and padding to parent last occurrence.

  1. $('div[class^="searchercustomcontent"]:visible').each(function(i) { 
  2.    $(this).parent('li[id^="order"]:visible:first').css({'margin-top': '0px'});
  3.    $(this).parent('li[id^="order"]:visible:last').css({'padding-bottom': '5px'});
  4.  });

Thanks,  Bill