I am trying to count the number of times that the fadeToggle
button appears and include it in <p>
paragraph element as text.
$(function () {
var box = $("#box");
var para = $("#p");
var count = 0;
for (var i = 0; i < 10; i++) {
function toggleBox(i) {
box.fadeToggle(500, function () {
count++;
para.text() = count(i);
});
}
toggleBox(i);
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…