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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -