php - how to assign values to textfields which are created using jquery -
am creating 1 application need add fields dynamically used jquery.now in text fields need retrieve values database , assign fields.
how implement that.
<script type="text/javascript"> (function($){ $countforms = 1; $.fn.addforms = function(){ var myform = "<table>"+ " <tr>"+ " <td>pid:</td>"+ " <td><input type='text' name='id["+$countforms+"]'></td>"+ " <td>pname:</td>"+ " <td><textarea name='name["+$countforms+"]'></textarea></td>"+ " <td>pfee:</td>"+ " <td><input type='text' name='amount["+$countforms+"]'></td>"+ " <td><button>remove</button></td>"+ " </tr>"+ "</table>"; myform = $("<div>"+myform+"</div>"); $("button", $(myform)).click(function(){ $(this).parent().parent().remove(); }); $(this).append(myform); $countforms++; }; })(jquery); $(function(){ $("#mybutton").bind("click", function(){ $("#container").addforms(); }); });
Comments
Post a Comment