I have this jQuery function that switches between different status messages (p elements) with ID's ranging from status_0 to status_5:
setTimeout(function() {
var next_status;
if (current_status < 5) {
next_status = current_status++;
} else {
next_status = 0;
}
$(".status_visible").fadeOut("fast", function() {
$("#status_"+next_status).fadeIn("fast");
});
//alert(next_status);
change_status();
}, 10000);
My problem is that to start with, current_status definitely equals 0, but when it gets to my increment part, it comes out as 0 still! I tried this with a simple next_status = current_status + 1, which returned 01 instead of 1 (concatenated them), so I tried next_status = current_status++ and it returned 0 still.
Can anybody put me straight here please :)
next_status = ++current_status % 5