I am using the code below. Problem is that every time I select the option it duplicates all the options and the list shows all the options again.
Here is the code:
if(x > 50){
var i, j;
j = 0;
for(i=0; i < x; i++){
if(i%50==0){
$('#startRecord').append(
$('<option></option>').val(i).html((j+1)+'-'+(j+=50)));
}
}
$('#dropDownSpan').css('visibility', 'visible');
}
for x = 121, it shows this on the first run:
<option value=0>1-50</option>
<option value=50>51-100</option>
<option value=100>1-121</option>
but when I select an option it reloads the page and then shows these options:
<option value=0>1-50</option>
<option value=50>51-100</option>
<option value=100>1-121</option>
<option value=0>1-50</option>
<option value=50>51-100</option>
<option value=100>1-121</option>
and if I do it a third time...it appends more and so on.
What can I do to prevent that from happening?
thanks