1
我正在使用Picasa Web Integrator(PWI)代碼,該代碼允許我使用Picasa帳戶呈現圖片庫。用戶使用表單寫入關鍵字,然後代碼創建一個div並調用PWI。如何動態刪除div並清除內存,以便使用jQuery添加具有相同ID但不同內容的新div?
它完美的工作,但我試圖添加一個「後退」按鈕,以便讓用戶選擇不刷新的關鍵字。
但代碼似乎沒有清除內存,結果與第一次相同。
下面是代碼:
//The button that the user presses when he has written the keyword.
$("#boton2").click(function() {
//Creates a new div
$(".shop3").append("<div></div>");
$('.shop3 > div').attr('id', 'container3');
//gets the keyword and creates a variable called "competidor"
competidor = $('#competidor_txt').val();
//calls for the PWI code...
$("#container3").pwi({
username: 'davidagnino',
mode: 'keyword',
...
//This part works perfectly.
//The "back" button that should delete the div called #container3
$('#back3').click(function() {
event.preventDefault();
competidor=null;
delete competidor;
$("#container3").empty(); //should make my div empty
$("#container3").remove(); //deletes the div...
});
你可以發佈一個鏈接到你的網頁(代碼)? – 2010-08-23 17:55:07