meeky
1
Can someone please tell me what is wrong with this code
function testing(str)
{
var str="";
var e=document.getElementsByName("complainthx[]");
for(var i=0; i<e.length;i++)
{
//var f=e[i];
return document.getElementsByName('complainthx[]')[i].value=str;
}
}
what do you expect it to happen that deosn’t work?
meeky
3
the value of str is not passing into the document.getElementsByName(‘complainthx’)[i] control
Is the function being called at all?
Having a return
inside a for
doesn’t seem right.
If you want only the first, why have a for loop?
If you want them all, move the return to after the loop.
1 Like
system
Closed
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.