Question: I have the following code:

```
var parentEls = $(root)
                .find("credit standard")
                .parents()
                .map(function () { 
                  return this.tagName; 
                    })
                .get()
                .join(" > ");
                alert(parentEls);

            $("#breadcrumb").append("<p>" + parentEls + "</p>");

```

This works fine to return the parents. However, I don't want to return tagName, I want the name attribute for each parent instead. I tried

```
.map(function () { 
                      return this.attr("name"); 
                        })

```

but this doesn't work. Is there any way to do this without resorting to a loop?

Answer: 
`attr` is no native method, it's a jQuery method. So try to wrap your `this` into a jQuery constructor:

```
return $(this).attr('name');

```

or use the `getAttribute` method instead:

```
return this.getAttribute('name');

```
I would try the following 

```
.map(function () { 
   return $(this).attr("name"); 
 })

```