2013-05-16 31 views
2

我想要動態地在列表視圖中獲取圖像圖標。如果我有5個圖像像0.png到4.png,我有5個列表中的列表視圖。列表名稱之前,我想要顯示圖像作爲圖標在ListView動態使用jQuery。如何使用jQuery獲取listview中的圖像圖標?

$("#list").append('<li><a href="#chapter" id="' + order + '"><img src="icons/"' + imageurl + ' id="imageURL"/>' + section + ' </a> </li>'); 

在此先感謝。

+0

爲你所做的沒有工作上面的代碼? –

+0

'id'在文檔中應該是唯一的,所有的圖片都會有相同的id,所以可能你應該刪除它 –

+0

在這裏我提到的代碼是用於附加html tags.how在一個listview中顯示多個圖像圖標。 – Lucky

回答

0

我得到了solution..For創建圖像作爲動態列表視圖圖標..

$('#').load(file, function (data) { 
    var txt = $(data).find('p').text(); 
    var image = $(data).find('img'); 
    var pic = $(data).find('img').attr('src'); 
    var picture = '<img src="'+ pic +'" style="width:100px;height:100px;"/>'; 
$("#content_list").append('<li><a href="#" class="style1" file="' + file + '">'+ picture +'<h2>' + content + ' </h2><p class="description">' + txt + '</p></a></li> ');