Return Attr via jQuery

by James Hooper

HTML

<div class="homepage_carousel">
  <div class="step1">
    <a href="#" title="HP Carousel 1">Homepage Carousel (1 step)</a>
  </div>
</div>

<div class="homepage_carousel">
  <div class="step1">
    <div class="step2">
      <a href="#" title="HP Carousel 2">Homepage Carousel (2 step)</a>    
    </div>
  </div>
</div>

JavaScript

var getTitle = $(this).find("a").attr("title");


console.log(getTitle);

$(".homepage_carousel").click(function(){
     var getTitle = $(this).find("a").attr("title");
     console.log(getTitle);
})