Arnold Layne
asked on
question about how to use .each() the right way
I want to find all divs with a class of 'addressLocation' within a div with an id of orders. I want to get the text inside each of the returned divs, and append it to a "waypoints" variable, and I'm not doing it the right way. I'm a little confused about the array and accessing objects in it. Here's my code. I'm hoping this is really easy, but I don't know how to do it correctly. Thanks a bunch.
var waypoints = "";
var addressArray = $("#orders").find('.directionsAddress');
$.each(addressArray, function (index, address) {
waypoints = waypoints + "|" + addressArray[index].text();
});
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are welcome - thanks for the points.
ASKER