Get values of textareas generated dynamically

Posted by Hulk on Stack Overflow See other posts from Stack Overflow or by Hulk
Published on 2010-03-29T05:30:07Z Indexed on 2010/03/29 5:33 UTC
Read the original article Hit count: 372

In the below code,the textaraes are generated dynamically ,now how to get these values for validations in valid() function..

  <script>
   function valid()
    {
         //get all textarea vales for validation
    }


  function add(col_det)
  {
 var row = '<tr>';
row += '<td>';
row += '<textarea rows = "8" cols = "8" class = "input" WRAP id="row_details'+r_count+'" name ="row_details'+r_count+'"></textarea>';
row += '</td>';
for (var i=0;i<col_det.length;i++)
{
   row += '<td> <div id = "div_content_bold"> <textarea rows = "2" cols = "8" class = "input" id="c_details'+c_count+'" name="col_details'+l_count+'" WRAP ></textarea> </div> </td>';

 }
 row += '<td></td>';
 row += '</tr>';
return row; 
 }



 $(document).ready(function() {
 var cnt = '<input type="text" name="title" id="title" ><br><br>';
 cnt += '<table cellspacing="0" cellpadding="0" border="1" width="100%" id="l_table">';
 cnt += '<tr>';
 cnt += '<th width="30%">Category</th>';
 cnt +=  headers(col_data); 
 cnt += '<th width="10%">Grade obtained</th>';
 cnt += '</tr>';
 for(var i=0;i<criteria;i++)
 {
   cnt += add(col_data,i);
 }
 cnt += '</table>';
 $('#content').append(cnt);

 });
</script>
<form action="create/" method="post" name="aa">
<div id="content"></div>
<table>
 <tr><td>
 <input type="submit" value="Save" id="Save" onclick="javascript:var   ret=validate(row_c,c_count);return ret;"/></td></tr>

Thanks....

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript