{"id":8653,"date":"2015-12-02T16:15:15","date_gmt":"2015-12-02T14:15:15","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=8653"},"modified":"2017-12-21T15:42:34","modified_gmt":"2017-12-21T13:42:34","slug":"jquery-foreach-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/","title":{"rendered":"jQuery forEach example"},"content":{"rendered":"<p>This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements.<\/p>\n<p>The jQuery <code>each()<\/code> function helps to iterate over an array, object properties and all HTML elements.<\/p>\n<p>This function has many overloaded signatures that take different arguments, all overloaded signatures take anonymous callback function to deal with current item.<\/p>\n<p>Let&#8217;s look at some examples. To download the jQuery library click <a href=\"https:\/\/jquery.com\/download\/\" target=\"_blank\">here<\/a>.<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;qGGDqWnle19VavkM&#8217;]<\/p>\n<h2>1. HTML<\/h2>\n<p>First of all you need to create a simple html document. <\/p>\n<pre class=\"brush:xml;highlight:[5]\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;jQuery forEach Example&lt;\/title&gt;\r\n\t&lt;script src=\"jquery-2.1.4.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2>2. jQuery foreach examples<\/h2>\n<h3>2.1 Iterate through selected checkboxes example <\/h3>\n<p>This example iterates over selected checkboxes&#8217; elements and shows their values in an alert.<\/p>\n<p>Let&#8217;s add some checkboxes with a link to our html code <\/p>\n<pre class=\"brush:xml;\">\r\n<!-- Example 1-->\r\n&lt;input type=\"checkbox\" name=\"color\" value=\"red\"&gt;Red&lt;\/br&gt;\r\n&lt;input type=\"checkbox\" name=\"color\" value=\"white\"&gt;White&lt;\/br&gt;\r\n&lt;input type=\"checkbox\" name=\"color\" value=\"blue\"&gt;Blue&lt;\/br&gt;\r\n&lt;a href=\"javascript:return 0\" onclick=\"showSelectedColors()\" &gt;Show Selected Colors&lt;\/a&gt;\r\n<\/pre>\n<p>In the following jQuery code, <code>$(\"input:checked\")<\/code> returns a list of checked boxes. To loop over this list <code>each()<\/code> function has been used. The <code>each()<\/code> function iterates over list and call callback function for each element . <code>$(this)<\/code> is used for accessing the current element. <\/p>\n<pre class=\"brush:js;highlight:[4,5]\">\r\n&lt;script type=\"text\/javascript\"&gt;\r\n\tfunction showSelectedColors(){\r\n\t\tvar selectedColors=\"selectedColors are \";\r\n\t\t$(\"input:checked\").each(function() {\r\n\t\t  selectedColors += $(this).val();\r\n\t\t  selectedColors +=\" \"\r\n\t\t});\r\n\t\talert(selectedColors);\r\n\t}\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>The result in the browser would be:<br \/>\n<figure id=\"attachment_8710\" aria-describedby=\"caption-attachment-8710\" style=\"width: 800px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example1.gif\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example1.gif\" alt=\"Iterate over selected colors example\" width=\"800\" height=\"300\" class=\"size-full wp-image-8710\" \/><\/a><figcaption id=\"caption-attachment-8710\" class=\"wp-caption-text\">Iterate through selected checkboxes example<\/figcaption><\/figure><\/p>\n<h3>2.2 Iterate through an array example <\/h3>\n<p>In the following example we will loop over an array of visitors&#8217; names and append them to html document . <\/p>\n<p>Let&#8217;s create a div with a simple link that calls javascript function when it is pressed .<\/p>\n<pre class=\"brush:xml;highlight:[11,12]\">\r\n&lt;style type=\"text\/css\"&gt;\r\n\t\t.areaInfo{\r\n\t\t\twidth:200px;\r\n\t\t\theight:200px;\r\n\t\t\tborder:2px solid #e0e0e0;\r\n\t\t\tpadding:10px;\r\n\t\t}\r\n&lt;\/style&gt;\r\n\r\n&lt;!-- Example 2--&gt;\r\n&lt;div id=\"area\" class=\"areaInfo\"&gt;&lt;\/div&gt;&lt;br\/&gt;\r\n&lt;a href=\"javascript:return 0\" onclick=\"showVisitors()\" &gt;Show Visitors&lt;\/a&gt;\r\n \r\n<\/pre>\n<p>The <code>$.each()<\/code> function takes two arguments. The first argument must be an array or object, this example passes an array. The second one is an anonymous callback function with two arguments: the index of the current item and the item&#8217;s value. Notice that the index starts with zero. <\/p>\n<pre class=\"brush:js;highlight:[3,6,7,8]\">\r\n&lt;script type=\"text\/javascript\"&gt;\r\n\t\/\/Example 2\r\n\tvar names = [\"Cem \",\"Can \",\"Kim \"] ;\r\n\tfunction showVisitors(){\r\n\t\t$(\"#area\").html(\"\");\r\n\t\t$.each(names,function(index,value) {\r\n\t\t  $(\"#area\").append(index +\"-\"+value+\"&lt;br\/&gt;&lt;br\/&gt;\");\r\n\t\t});\r\n\t}\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>The result in the browser would be:<br \/>\n<figure id=\"attachment_8721\" aria-describedby=\"caption-attachment-8721\" style=\"width: 800px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example2.gif\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example2.gif\" alt=\"Iterate through an array example\" width=\"800\" height=\"300\" class=\"size-full wp-image-8721\" \/><\/a><figcaption id=\"caption-attachment-8721\" class=\"wp-caption-text\">Iterate through an array example<\/figcaption><\/figure><\/p>\n<h3>2.3 Iterate through an object example <\/h3>\n<p>In the following example we will loop over an object&#8217;s properties and we will append them to the html document. <\/p>\n<p>Let&#8217;s create a div with a simple link that calls a javascript function when it is pressed .<\/p>\n<pre class=\"brush:xml;highlight:[11,12]\">\r\n&lt;style type=\"text\/css\"&gt;\r\n\t\t.areaInfo{\r\n\t\t\twidth:200px;\r\n\t\t\theight:200px;\r\n\t\t\tborder:2px solid #e0e0e0;\r\n\t\t\tpadding:10px;\r\n\t\t}\r\n&lt;\/style&gt;\r\n\r\n&lt;!-- Example 3--&gt;\r\n&lt;div id=\"area\" class=\"areaInfo\"&gt;&lt;\/div&gt;&lt;br\/&gt;\r\n&lt;a href=\"javascript:return 0\" onclick=\"showStudentInfo()\" &gt;Show Student Info&lt;\/a&gt;\r\n<\/pre>\n<p>As explained in the previous example, the first argument of the <code>$.each()<\/code> function may be an object. If the first argument is an object, then the callback function will get the object&#8217;s property name as it&#8217;s first argument and the second will be the property value. <\/p>\n<pre class=\"brush:js;highlight:[3,6,7,8]\">\r\n&lt;script type=\"text\/javascript\"&gt;\r\n\t\/\/Example 3\r\n\tvar student = {name:\"Cem \" , age:22, country:\"us\"}\r\n\tfunction showStudentInfo(){\r\n\t\t$(\"#area\").html(\"\");\r\n\t\t$.each(student,function(k,value) {\r\n\t\t  $(\"#area\").append(k +\" : \"+value+\"&lt;\/br&gt;&lt;\/br&gt;\");\r\n\t\t});\r\n\t}\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>The result in the browser would be:<br \/>\n<figure id=\"attachment_8730\" aria-describedby=\"caption-attachment-8730\" style=\"width: 800px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example3.gif\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery_foreach_example3.gif\" alt=\"Iterate through an object example \" width=\"800\" height=\"300\" class=\"size-full wp-image-8730\" \/><\/a><figcaption id=\"caption-attachment-8730\" class=\"wp-caption-text\">Iterate through an object example<\/figcaption><\/figure><\/p>\n<h2>3.Conclusion<\/h2>\n<p>Looping through an array or object properties is useful and most commonly used in the programming world. jQuery provides a powerful function that helps in looping through an array or object. The jQuery <code>each()<\/code> function is used to loop over a collection of elements and send each element&#8217;s info to a callback function. The jQuery <code>each()<\/code> function has many overloaded signatures that take different arguments as demonstrated in the previous examples.<\/p>\n<h2>4. Download<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here : <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/jquery-foreach-example.zip\"><strong>jquery foreach example<\/strong><\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to iterate over an array, object properties and all HTML elements. This function has many overloaded signatures that take different arguments, all overloaded signatures take anonymous callback function to deal with current &hellip;<\/p>\n","protected":false},"author":106,"featured_media":919,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-8653","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>jQuery forEach example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to\" \/>\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.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"jQuery forEach example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-02T14:15:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-21T13:42:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Saeb Najim\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Saeb Najim\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\"},\"author\":{\"name\":\"Saeb Najim\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7554117e1066be33eda4c81bac192cc9\"},\"headline\":\"jQuery forEach example\",\"datePublished\":\"2015-12-02T14:15:15+00:00\",\"dateModified\":\"2017-12-21T13:42:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\"},\"wordCount\":485,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\",\"name\":\"jQuery forEach example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"datePublished\":\"2015-12-02T14:15:15+00:00\",\"dateModified\":\"2017-12-21T13:42:34+00:00\",\"description\":\"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"jQuery\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jQuery forEach example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7554117e1066be33eda4c81bac192cc9\",\"name\":\"Saeb Najim\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1a6884eb32867720ef22a2a7728235120963a9a750d54d0356d5e3619ad3cd06?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1a6884eb32867720ef22a2a7728235120963a9a750d54d0356d5e3619ad3cd06?s=96&d=mm&r=g\",\"caption\":\"Saeb Najim\"},\"description\":\"Saeb has graduated from the University of Technology. During the last ten years (since 2005) he has been involved with a large number of projects about programming, software engineering, design and analysis . He works as a senior Software Engineer in the e-commerce and web development sector where he is mainly responsible for projects based on Java, Java frameworks, design patterns and Big Data technologies.\",\"sameAs\":[\"http:\/\/www.webcodegeeks.com\/\",\"https:\/\/www.linkedin.com\/in\/saebnajim\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/saeb-najim\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"jQuery forEach example - Web Code Geeks - 2026","description":"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to","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.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/","og_locale":"en_US","og_type":"article","og_title":"jQuery forEach example - Web Code Geeks - 2026","og_description":"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-12-02T14:15:15+00:00","article_modified_time":"2017-12-21T13:42:34+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","type":"image\/jpeg"}],"author":"Saeb Najim","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Saeb Najim","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/"},"author":{"name":"Saeb Najim","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7554117e1066be33eda4c81bac192cc9"},"headline":"jQuery forEach example","datePublished":"2015-12-02T14:15:15+00:00","dateModified":"2017-12-21T13:42:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/"},"wordCount":485,"commentCount":2,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","articleSection":["jQuery"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/","name":"jQuery forEach example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","datePublished":"2015-12-02T14:15:15+00:00","dateModified":"2017-12-21T13:42:34+00:00","description":"This example explains how to use iteration in jQuery. jQuery provides a powerful function for looping over elements. The jQuery each() function helps to","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-foreach-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"jQuery","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/"},{"@type":"ListItem","position":4,"name":"jQuery forEach example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7554117e1066be33eda4c81bac192cc9","name":"Saeb Najim","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1a6884eb32867720ef22a2a7728235120963a9a750d54d0356d5e3619ad3cd06?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1a6884eb32867720ef22a2a7728235120963a9a750d54d0356d5e3619ad3cd06?s=96&d=mm&r=g","caption":"Saeb Najim"},"description":"Saeb has graduated from the University of Technology. During the last ten years (since 2005) he has been involved with a large number of projects about programming, software engineering, design and analysis . He works as a senior Software Engineer in the e-commerce and web development sector where he is mainly responsible for projects based on Java, Java frameworks, design patterns and Big Data technologies.","sameAs":["http:\/\/www.webcodegeeks.com\/","https:\/\/www.linkedin.com\/in\/saebnajim"],"url":"https:\/\/www.webcodegeeks.com\/author\/saeb-najim\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/8653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/106"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=8653"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/8653\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/919"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=8653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=8653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=8653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}