javascript - How to manipulate loops with input? -
i got loop , i
manipulate counter i
input on screen. below can select 1 10 , want selection replaced counter in loop. means when choose 2, i
should 2. started code below, document.getelementbyid('options').innerhtml = "i"
; seems wrong code manipulate. help!
<select id="options" size="1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> (i=0, i<somearray; i++){ somethingwith[i];} document.getelementbyid('options').innerhtml = "i";
you need value of select
element , assign i
.
var = document.queryselector('#options').value; for(i < somearray; i++){ //code }
Comments
Post a Comment