Add More Textarea

In the Add More Textarea script is use to create multiple a textarea at client side through DOM.Textarea use to enter for the multi line text.

Demo :



Textarea :
 

Example :

You click a Add More button and see more textarea at broswer.

Code :

Following code is Add More Textarea script code if you need to copy and use to your web site.


<script>
function createTextArea(parent_id, child_name, child_id)
{
  var myTable=document.getElementById(parent_id);
  var oDiv, oInput;
  oDiv = document.createElement('div');
  oDiv.setAttribute('id', 'Name');
  myTable.appendChild(oDiv);

  var oInput = document.createElement('textarea');
  oInput.setAttribute('name', child_name);
  oInput.setAttribute('id', child_id);
  oInput.rows=3;
  oInput.cols=25;
  oDiv.appendChild(oInput);
}

var child = 1;
function child_fun()
{
  return child++;
}
</script>

<form id="add_textarea_frm" name="add_textarea_frm" method="post" action="">
<div id="add_more_div">
  <textarea id="add_more" name="add_more" rows="3" cols="25"></textarea>
</div>
<a href="javascript:;" onclick="return createTextArea('add_more_div','add_more[]',child_fun());">Add More...</a>
</form>

In the above createTextArea() function is use to create more a textarea.That functions have three arguments that is parent_id, child_name and child_id.In the parent_id is replace div id and add_more is parent text box name and child_id is to would replace to child textarea.In the child_fun() function is use to create child id for textarea.

Free Download Script:

If you need to Add More Textarea Script click and download from following zip file.

Download




Content