Right so the question maybe doesn't illustrate what I'm trying to say but here's what I'm trying to achieve. I have got 6 text boxes on a page each of which contains a number between 0 and 500 (there is no limit but I'm not expecting the number to be higher than this). This number is dependent on a calculation elsewhere, but is irrelevant for this question so I've left it out. Anyway, what I'm trying to do is; Run through a loop and assign a new text box \[code\]scoreone, scoretwo\[/code\] etc in the code below an index between 1 and 10 based on the size of the values in \[code\]indexone, indextwo\[/code\] etc.So for example if \[code\]indexone\[/code\] contains 15, the textbox \[code\]scoreone\[/code\] will be populated with 0. Now this works fine, but only for one textbox, as I have six, I'm not sure how to do this for all of them (i.e. one after the other). I'm using JavaScript and jQuery...HTML:\[code\]<input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/20" id="indexone" /><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scoreone" /><br><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/60" id="indextwo" /><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scoretwo" /><br><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/100" id="indexthree"/><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scorethree" /><br><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/160" id="indexfour"/><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scorefoure" /><br><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/180" id="indexfive"/><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scorefive" /><br><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/210" id="indexsix"/><input type="text" disabled="disabled" value="http://stackoverflow.com/questions/12821916/0" id="scoresix" /><br>\[/code\]JS:\[code\]var indexArray = [indexone, indextwo, indexthree, indexfour, indexfive, indexsix];for (var i = 0; i < indexArray.length; i++) { if ((indexArray >= 0) && (indexArray < 25)) { scoreone = parseInt(1); $('#scoreone').val(scoreone); } else if ((indexArray >= 25) && (indexArray < 50)) { scoreone = parseInt(2); $('#scoreone').val(scoreone); } else if ((indexArray >= 50) && (indexArray < 75)) { scoreone = parseInt(3); $('#scoreone').val(scoreone); } else if ((indexArray >= 75) && (indexArray < 100)) { scoreone = parseInt(4); $('#scoreone').val(scoreone); } else if ((indexArray >= 100) && (indexArray < 125)) { scoreone = parseInt(5); $('#scoreone').val(scoreone); } else if ((indexArray >= 125) && (indexArray < 150)) { scoreone = parseInt(6); $('#scoreone').val(scoreone); } else if ((indexArray >= 150) && (indexArray < 175)) { scoreone = parseInt(7); $('#scoreone').val(scoreone); } else if ((indexArray >= 175) && (indexArray < 200)) { scoreone = parseInt(8); $('#scoreone').val(scoreone); } else if ((indexArray >= 200) && (indexArray <= 225)) { scoreone = parseInt(9); $('#scoreone').val(scoreone); } else if (indexArray > 225) { scoreone = parseInt(10); $('#scoreone').val(scoreone); }}\[/code\]I've put what I'm trying to do in a fiddle here too...