<div class="item">
<p><img src="images/photos_sample1.jpg"
border="0" rel="images/google_map.jpg"></p>
<p>Dining Area</p>
</div>
<div class="item">
<p><img src="images/photos_sample2.jpg"
border="0" rel="images/sample_photo.jpg"></p>
<p>Pool Area</p>
</div>
I have the above HTML code and I want to get the rel attribute's value when I click the image. I wrote this jQuery script, but it doesn't seem to work:
$('div.item').click(function() {
var getvalue = $('this > p > img').attr('rel');
alert(getvalue);
});