var color_arr = ["red","blue","red","blue","red","blue"];
var html = "";
for(var i = 0; i < color_arr.length; i++) {
html += "<button id='user_color_"+i +"' class='btn' style='background:"+ color_arr[i] +"'></button>";
}
$("#somelement").append(html);
因此,如果用戶點擊一個按鈕,則該按鈕必須被刪除。如何在點擊時刪除按鈕?
爲什麼你會用id,當你已經有對象本身? –