MVS800824
MVS800824

Reputation: 1

how to control for loop

this is my code......initially alltextboxes is showing...if i click the next or prev button it works properly....but i want only two textboxes per each click so initialy should show two text box ..........how i get it........how to solve......

see for full code:http://jsfiddle.net/sankarss/gAVZ8/22/

function starts(values)
{

    maximum=values;
    var form = document.forms[0];
    var container = $("#sankar");
    container.empty();
    for (var i = 0; i < maximum; i++)  
        container.append('<fieldset style="width: 250px; height: 80px;"><legend>Files of ' +(i + 1) + ' / ' + maximum + '</legend><input type="text" name="name' + i + '" /><br /><br /><input type="text" name="topic' + i + '" /></fieldset>');

    goto(form, 0);
}

Upvotes: 0

Views: 77

Answers (1)

kirb
kirb

Reputation: 2049

Simply put this code under the for() line:

if(i>=2){
    continue;
}

Ad@m

Upvotes: 1

Related Questions