$('td').click(function () {
var total = $('<div id="total"></div>')
var price = +($(this).text())
var old = +($('#total').text())
var newPrice = (old + price)
$('<div class="notice"></div>')
.append('<div class="skin"></div>')
.append($('<div class="content"></div>').text('Total price:' + " " + $('#total').text(newPrice)))
.hide()
.appendTo('#panel_two')
.fadeIn(1000);
$('#panel_two').fadeIn().appendTo('#windowContainer');
}
我在尝试显示我的 newPrice (Total price:) 有什么想法吗?
但是,这很好用:
$(document).ready(function(){
$('td').click(function(){
var Price = +($(this).text());
var Old = +($('#Total').text());
var New = (Old + Price);
$('#Total').text(New);
})
})