views:

39

answers:

1

I have a code that retrieves all the "place names" and all the "addresses" separately in this link:

http://www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON

I need to modify my code so that it will only retrieve the placename and address if

<div class="address""> is not found within <div class="listingDetail"">

class="address" is the address of the location, class="listingDetail" is the parent, or container. Some screenshots, please view them for better understanding:

http://i52.tinypic.com/67moog.png

http://i55.tinypic.com/289f7n.png

A: 

If you use javascript use:

var addresses = Array.filter( document.getElementsByClassName('listingDetail'), function(listingDetail){  
   return listingDetail.getElementsByClassName('address');  
 });
stevebot