var play = function(){
var counter = 0;
if(counter == 0){
$(this).click(function(e) {
var targetBox = (e.target.id);
$("#" + targetBox).append("something");
counter++;
})
} else if (counter == 1){
$(this).click(function(e) {
var targetBox = (e.target.id);
$("#" + targetBox).append("O");
counter--;
});
}
}
我試圖讓一個按鈕,用一個計數器改變什麼附加到我的targetBox
。如果計數器是1,則附加一些東西,如果計數器是0,則附加其他東西。任何幫助將不勝感激有沒有辦法將不同的東西添加到div與計數器?
感謝這個工作 –