lordphate Posted March 5, 2009 Share Posted March 5, 2009 Hey everyone, I had a quick question, what would be the best way to implode dynamically generated textfields [generated through ajax]. The dynamic textfield would have a "name"+ count <input type="textfield" name="textfield0"... Basically i'm wanting to implode each "textfield#" seperated by || or something close to that. I was thinking a foreach ? But then i can't figure out how to get the number of textfields Any help would be appreciated [bTW i'm not looking for the actual answer, just a suggestion on how to go about doing this, i'm trying to learn ajax, and it's through me for a loop ] Link to comment https://forums.phpfreaks.com/topic/148026-dynamic-form-variables/ Share on other sites More sharing options...
RussellReal Posted March 5, 2009 Share Posted March 5, 2009 <script type="text/javascript"> function doal() { var d = document; var a = d.getElementsByTagName("input"); for (i in a) { if (a[i].name.indexOf("number") >= 0) alert(a[i].name); } } </script> <form name="rawr"> <input type="text" name="number0" /> <input type="text" name="number1" /> <input type="text" name="number2" /> <input type="text" name="number3" /> </form> <input type="button" onclick="doal()" /> Link to comment https://forums.phpfreaks.com/topic/148026-dynamic-form-variables/#findComment-777032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.