-1
如果我按1按鈕,它會詢問我什麼時候是銀或金。jQuery:增加值超時
如果我點擊銀,我的獎金將被+150 000
添加現在,我與expetation工作,我的獎金: 增量由150K,300K,450K等
但現在, 輸出爲0150000150000150000
這裏是我的代碼
var currentCircleId = '';
var balance='0'
$(document).ready(function(){
$(".circle").click(function(){
$(".selection").toggle();
currentCircleId = $(this).attr('id');
});
$('.selection').click(function(){
$(".selection").toggle();
var newClass = $(this).data('new-class');
$('#' + currentCircleId).removeClass('gold silver').addClass(newClass);
});
$('.countsilver').click(function(){
balance+=150000;
$("#bonus1").html(balance);
});
});
.circle{
\t border-radius: 50%;
\t border: solid 1px black;
\t height: 33px;width: 33px;
\t background: none;
\t position: relative;
\t cursor: pointer;
}
.silver{
\t background-color:#c0c0c0;
}
.gold{
\t background-color:#ffd700;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<a class="selection countsilver" data-new-class="silver" style="display: none;">SILVER</a>
\t <a class="selection countgold" data-new-class="gold" style="display: none;">GOLD</a>
\t <div class="circle" id="16"><p id="z16"></p></div>
\t <p>Bonus 1 gain = <span id="bonus1"></span>
有人能告訴我正確的方法嗎? 謝謝