Into a php page I have 20 text boxes. I want to make a button, using javascript, and when user clicks on it the rest 19 text boxes to take 1st text box's text. I have done something like this but it isn't working... Any idea?
function Throw_PhotoStuff(){
var pcount=1;
while(pcount<20;){
document.getElementById('photo_'+pcount).value = document.getElementById('photo_1').value; pcount++;
}
}
naveen goyal
4,6272 gold badges18 silver badges26 bronze badges
2 Answers 2
remove the semicolon from while loop, like:
while(pcount<20;){ //will show SyntaxError: missing ) after condition
to
while(pcount<20){
answered Sep 24, 2013 at 7:27
Sudhir Bastakoti
100k15 gold badges163 silver badges169 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
I think you have extra semicolon here while(pcount<20;){
remove this
answered Sep 24, 2013 at 7:29
Gurminder Singh
1,75516 silver badges19 bronze badges
Comments
lang-js
while(pcount<20;)towhile(pcount<20). Thank you all guys!