user3709132
user3709132

Reputation: 21

variable not incrementing

var ro = 0;

function updatePR(sel){
    if(sel.value==1){
        $(".holder").append("<div id='simulador-"+ro+"'></div>");
        $("#simulador-"+ro).load("inv-imo.php .IM");
        ro=ro++;
    }else if(sel.value==2){
        $(".holder").append("<div id='simulador-"+ro+"'></div>");
        $("#simulador-"+ro).load("poupanca.php .SP");
        ro=ro++;
    }else if(sel.value==3){
        $(".holder").append();
    }
}

I have this code and I'm having trouble with the variable ro, which doesn't increment.

Everytime that I run the function, ro is always 0.

Anyone knows why?

Upvotes: 1

Views: 2326

Answers (1)

Christos
Christos

Reputation: 53958

Replace this ro=ro++; with this ro++; or this ro=ro+1.

Upvotes: 3

Related Questions