{"id":434,"date":"2014-12-29T16:16:13","date_gmt":"2014-12-29T16:16:13","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=434"},"modified":"2023-09-01T06:43:49","modified_gmt":"2023-09-01T06:43:49","slug":"add-remove-input-fields-dynamically-using-jquery","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/","title":{"rendered":"Add Remove Input Fields Dynamically using jQuery"},"content":{"rendered":"<p><b>Dynamic input field<\/b> allows providing multiple values in a form. It is very useful when you want to receive multiple inputs for the same field in an HTML form. The dynamic input fields feature can be easily integrated using jQuery. You can add multiple fields and remove fields easily. In this tutorial, we will show you how to add or remove input fields or text boxes dynamically in a form using jQuery and get multiple input field values using PHP.<\/p>\n<p>The example code shows how to generate input fields on the fly in a form and submit the input field&#8217;s value into the database. This script is very useful to add\/remove input fields and post multiple values in PHP. The jQuery will be used to make this functionality simple and powerful. The following functionalities will be implemented to <b>add more fields dynamically using jQuery<\/b> and PHP.<\/p>\n<ul>\n<li>Add and remove input fields dynamically using jQuery.<\/li>\n<li>Get multiple input field values using PHP.<\/li>\n<\/ul>\n<h2>Add \/ Remove Input Fields Dynamically using jQuery<\/h2>\n<p>In this example script, we will show you how to add more fields dynamically using jQuery.<\/p>\n<p><b>JavaScript Code:<\/b><br \/>\njQuery will be used to attach click events on add and remove buttons, so include the jQuery library first.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">script<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.7.0\/jquery.min.js\"<\/span>>&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n<\/pre>\n<p>The following JavaScript code handles the add\/remove input field functionality using jQuery.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>The <code>maxField<\/code> variable holds the maximum number of input fields to be added.<\/li>\n<li>The <code>addButton<\/code> variable selects the add button element.<\/li>\n<li>The <code>wrapper<\/code> variable selects the parent element of input fields.<\/li>\n<li>The <code>fieldHTML<\/code> variable holds the HTML of the new input field.<\/li>\n<li>Once the <b>Add<\/b> button is clicked, it will check the maximum input field limit. If field counter (x) is less than <code>maxField<\/code>, the new input field HTML will append into the fields parent div (<code>wrapper<\/code>). Also, the field counter will increase.<\/li>\n<li>Once the <b>Remove<\/b> button is clicked, the parent div of that particular Remove button will be removed. Also, the field counter will decrease.<\/li>\n<\/ul>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n<span style=\"color: rgb(110, 107, 94);\">$(<span class=\"hljs-built_in\" style=\"color: rgb(182, 86, 17);\">document<\/span>).ready(<span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span>(<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> maxField = <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">10<\/span>; <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Input fields increment limitation<\/span>\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> addButton = $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'.add_button'<\/span>); <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Add button selector<\/span>\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> wrapper = $(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'.field_wrapper'<\/span>); <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Input field wrapper<\/span>\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> fieldHTML = <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;div&gt;&lt;input type=\"text\" name=\"field_name[]\" value=\"\"\/&gt;&lt;a href=\"javascript:void(0);\" class=\"remove_button\"&gt;&lt;img src=\"images\/remove-icon.png\"\/&gt;&lt;\/a&gt;&lt;\/div&gt;'<\/span>; <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/New input field html <\/span>\r\n    <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> x = <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">1<\/span>; <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Initial field counter is 1<\/span>\r\n    \r\n    <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Once add button is clicked<\/span>\r\n    $(addButton).click(<span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span>(<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n        <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Check maximum number of input fields<\/span>\r\n        <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">if<\/span>(x &lt; maxField){ \r\n            x++; <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Increase field counter<\/span>\r\n            $(wrapper).append(fieldHTML); <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Add field html<\/span>\r\n        }<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n            alert(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'A maximum of '<\/span>+maxField+<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">' fields are allowed to be added. '<\/span>);\r\n        }\r\n    });\r\n    \r\n    <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Once remove button is clicked<\/span>\r\n    $(wrapper).on(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'click'<\/span>, <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'.remove_button'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span>(<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\">e<\/span>)<\/span>{\r\n        e.preventDefault();\r\n        $(<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">this<\/span>).parent(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'div'<\/span>).remove(); <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Remove field html<\/span>\r\n        x--; <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/Decrease field counter<\/span>\r\n    });\r\n});<\/span>\r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p><b>HTML Code:<\/b><br \/>\nInitially, a single input field will display with the Add button. When the Add button is clicked, the duplicate input field HTML will appear with a Remove button.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"field_wrapper\"<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">input<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"text\"<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"field_name[]\"<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"\"<\/span>\/&gt;<\/span>\r\n        <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"javascript:void(0);\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"add_button\"<\/span> <span class=\"hljs-attr\">title<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"Add field\"<\/span>&gt;<\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"images\/add-icon.png\"<\/span>\/&gt;<\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">a<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span><\/pre>\n<h2>Get Values from Multiple Input Fields using PHP<\/h2>\n<p>Once the multiple input form fields are added and submitted, the values can be retrieved using PHP. You can get the multiple values as an array using the $_POST method in PHP.<\/p>\n<pre><span style=\"color: #0000BB\">$field_values_array&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'field_name'<\/span><span style=\"color: #007700\">];<br \/><br \/><\/span><span style=\"color: #0000BB\">print_r<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$field_values_array<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<pre><span style=\"color: #FF8000\">\/\/ Output<br><\/span><span style=\"color: #007700\">Array<br>(<br>&nbsp;&nbsp;&nbsp;&nbsp;[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]&nbsp;=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">value1<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">1<\/span><span style=\"color: #007700\">]&nbsp;=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">value2<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">2<\/span><span style=\"color: #007700\">]&nbsp;=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">value3<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">3<\/span><span style=\"color: #007700\">]&nbsp;=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">value4<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br><\/span><span style=\"color: #007700\">)<\/span><\/pre>\n<p>After you fetch the multiple input field values, use foreach loop to insert the values into the database or whatever you want to process further.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;multiple&nbsp;input&nbsp;field's&nbsp;value&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$field_values_array&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'field_name'<\/span><span style=\"color: #007700\">];<br \/><br \/>foreach(<\/span><span style=\"color: #0000BB\">$field_values_array&nbsp;<\/span><span style=\"color: #007700\">as&nbsp;<\/span><span style=\"color: #0000BB\">$value<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Your&nbsp;database&nbsp;query&nbsp;goes&nbsp;here<br \/><\/span><span style=\"color: #007700\">}<br \/><\/span><\/pre>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/add-remove-input-fields-group-dynamically-jquery\/\">Add Remove Input Fields Group Dynamically with jQuery<\/a><\/span><\/p>\n<h2>Conclusion<\/h2>\n<p>Add more fields feature is very useful when you want to allow the user to add multiple inputs in web form. This example script helps you integrate add\/remove multiple input fields functionality using jQuery. The user can add or remove fields dynamically and submit multiple values. Moreover, you can get values from multiple input fields easily using PHP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dynamic input field allows providing multiple values in a form. It is very useful when you want to receive multiple inputs for the same field in an HTML form. The dynamic input fields feature can <\/p>\n","protected":false},"author":1,"featured_media":5465,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[123,66,16,14],"class_list":["post-434","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-addmore","tag-javascript","tag-jquery","tag-php","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Add Remove Input Fields Dynamically using jQuery - CodexWorld<\/title>\n<meta name=\"description\" content=\"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add Remove Input Fields Dynamically using jQuery - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-29T16:16:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-01T06:43:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Add Remove Input Fields Dynamically using jQuery\",\"datePublished\":\"2014-12-29T16:16:13+00:00\",\"dateModified\":\"2023-09-01T06:43:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/\"},\"wordCount\":490,\"commentCount\":36,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png\",\"keywords\":[\"AddMore\",\"JavaScript\",\"jQuery\",\"PHP\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/\",\"name\":\"Add Remove Input Fields Dynamically using jQuery - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png\",\"datePublished\":\"2014-12-29T16:16:13+00:00\",\"dateModified\":\"2023-09-01T06:43:49+00:00\",\"description\":\"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\\\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png\",\"width\":1920,\"height\":1080,\"caption\":\"add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-remove-input-fields-dynamically-using-jquery\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add Remove Input Fields Dynamically using jQuery\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add Remove Input Fields Dynamically using jQuery - CodexWorld","description":"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/","og_locale":"en_US","og_type":"article","og_title":"Add Remove Input Fields Dynamically using jQuery - CodexWorld","og_description":"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.","og_url":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2014-12-29T16:16:13+00:00","article_modified_time":"2023-09-01T06:43:49+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Add Remove Input Fields Dynamically using jQuery","datePublished":"2014-12-29T16:16:13+00:00","dateModified":"2023-09-01T06:43:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/"},"wordCount":490,"commentCount":36,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","keywords":["AddMore","JavaScript","jQuery","PHP"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/","url":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/","name":"Add Remove Input Fields Dynamically using jQuery - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","datePublished":"2014-12-29T16:16:13+00:00","dateModified":"2023-09-01T06:43:49+00:00","description":"Add more fields dynamically using jQuery - Add or remove input fields or text boxes in a form using jQuery and PHP. Example code to add\/remove multiple input fields dynamically using jQuery and get multiple input field values using PHP.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","width":1920,"height":1080,"caption":"add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/add-remove-input-fields-dynamically-using-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Add Remove Input Fields Dynamically using jQuery"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/12\/add-remove-multiple-input-fields-dynamically-using-jquery-get-values-php-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-70","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":14,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":5464,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/434\/revisions\/5464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/5465"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}