One of my projects need our clients to create textarea input dynamically with javascript. Seems it's kinda simple but actually, create dynamically is simple but how to fetch data from these is kinda complicated. So, I reserach through and thinking of about that. Finally, I gotcha..!! Here you gooo...
Example.html
2<p id="parah"></p>
3<input type="hidden" name="mytextcount">
4<a href="javascript:addInput()">Add more input field(s)</a><br>
5<a href="javascript:deleteInput()">Remove field(s)</a>
6<form>
7
8<invalidTag>
9var arrInput = new Array(0);
10var arrInputValue = new Array(0);
11function addInput() {
12arrInput.push(arrInput.length);
13arrInputValue.push("");
14display();
15}
16function display() {
17document.getElementById('parah').innerHTML="";
18for (intI=0;intI<arrInput.length;intI++) {
19document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
20}
21}
22function saveValue(intId,strValue) {
23arrInputValue[intId]=strValue;
24}
25function createInput(id,value) {
26return "<textarea cols='40' rows='5' id='test "+ id +"' name='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'></textarea><br>";
27}
28function deleteInput() {
29if (arrInput.length > 0) {
30arrInput.pop();
31arrInputValue.pop();
32}
33display();
34}
35var arrInput = new Array(0);
36
37var arrInputValue = new Array(0);
38
39function addInput() {
40
41arrInput.push(arrInput.length);
42
43arrInputValue.push("");
44
45display();
46
47}
48
49function display() {
50
51document.getElementById('parah').innerHTML="";
52
53for (intI=0;intI<arrInput.length;intI++) {
54
55document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
56
57}
58
59}
60
61function saveValue(intId,strValue) {
62
63arrInputValue[intId]=strValue;
64
65}
66
67function createInput(id,value) {
68
69return "<textarea cols='40' rows='5' id='test "+ id +"' name='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'></textarea><br>";
70
71}
72
73function deleteInput() {
74
75if (arrInput.length > 0) {
76
77arrInput.pop();
78
79arrInputValue.pop();
80
81}
82
83display();
84
85}
86
87</script>

Android
Top of Page