How can I extract the fb:profile-pic uid attribute value using jQuery?
From the following XML, I must extract the value of the uid attribute (557103888) on the fb:profile-pic
element:
<li class="ui-widget-content ui-corner-tr ui-draggable">
<fb:profile-pic height="32" width="32" linked="false" uid="557103888" style="width: 32px; height: 32px;" class=" fb_profile_pic_rendered">
<img class="" style="width: 32px; height: 32px;" title="some name" alt="some name" src="files/t557103228_5135.jpg">
</fb:profile-pic>
</li>
I'm using jQuery, and so far have the following开发者_Python百科 code:
function deleteImage($item) {
$item.fadeOut(function() {
var $list = $('ul',$trash).length ? $('ul',$trash) : $('<ul class="gallery ui-helper-reset"/>').appendTo($trash);
$item.find('a.ui-icon-trash').remove();
$item.appendTo($list).fadeIn(function() {
//alert($('.fb_profile_pic_rendered').attr('uid'));
//alert("added "+ $count + " " + $item.find('img').attr('src'));
findUserID($item.find('img').attr('src'));
$item.animate({ width: '48px' }).find('img').animate({ height: '36px' });
$count++;
})
});
}
Try this:
alert($('.fb_profile_pic_rendered').attr('uid'));
精彩评论