sorry for weird question…
so i want to alert (testing for now) values of text boxes using javascipt and php and right now, i have loops creating various text boxes with the same name. when i try to alert a text box with a name, it chooses only the first one… i’m not sure how to deal whit this. is there a way to do this with forms or div? heres some code…
function insertComment(comment){
alert(comment);
}
//say... i have a for loop that makes 5 of these
echo "<textarea rows='3' cols='20' name='txt_comment' id = 'txt_comment'>Enter comment here...</textarea>" . "</br>";
echo "<button onClick='insertComment(txt_comment.value)'>Submit Comment</button>";
thanks!
give each text box a same class say “text-boxes” and then use jquery method each
or try giving diff id to each textbox if using a loop like
and in js function loop with the same thing