Reputation: 676
I have the following html
<a class="lid" id="1">
<div class="map_image">
<img width="220" height="145" alt="" src="photo.jpg" typeof="foaf:Image">
</div>
</a>
Im using the following jquery to get the id of a link.
function onlid {
.setContent($(this).attr("id"));
}
$('.lid').on('mouseover', onlid);
so in this case content is set to 1, as the id of a class lid is 1.
what I would like is to get the whole html of and set it after 1.
So content would be
1 <img width="220" height="145" alt="" src="photo.jpg" typeof="foaf:Image">
Im trying something like
.setContent($(this).attr("id") + $(this.map_image).html());
Any help is appreciated.
Thanks
Upvotes: 0
Views: 262
Reputation: 6657
From your question it's not entirely clear what you're trying to do with the HTML.
This code should find the HTML inside of your map_image
class relative to that anchor tag and alert it:
function onlid (event) {
var $lid = $(event.target);
var imgHTML = $lid.find('.map_image')[0].innerHTML;
var lidId = $lid.attr('id');
alert(lidId + imgHTML);
}
Upvotes: 1