I am generating a dropdown on a completely separate page by jquery append function. I was getting duplicate rows of data if I just use append
if(params.totalRecords > 50){
var i, j;
j = 0;
for(i=0; i < params.totalRecords; i++){
if(i%50==0){
$('#startRecord').append(
$('<option></option>').val(i).html((j+1)+'-'+(j+=50)));
}
}
$('#dropDownSpan').css('visibility', 'visible');
}
so now when I was adding the values to drop down it was adding duplicate rows like this
<option value=0>1-50</option>
<option value=50>51-100</option>
<option value=0>1-50</option>
depending what option I would choose, it would just make it duplicate.
Now to avoid that I did the following
if(params.totalRecords > 50){
$('#startRecord').val(0).html("1-50");
var i, j;
j = 0;
for(i=0; i < params.totalRecords; i++){
if(i%50==0){
$('#startRecord').append(
$('<option></option>').val(i).html((j+1)+'-'+(j+=50)));
}
}
$('#dropDownSpan').css('visibility', 'visible');
}
Now the problem is that it alway restes it to 1-50 records cause of
$('#startRecord').val(0).html("1-50");
How could I show the last selected one there. thanks