{"id":10083,"date":"2024-01-19T18:14:00","date_gmt":"2024-01-19T18:14:00","guid":{"rendered":"https:\/\/codehim.com\/?p=10083"},"modified":"2024-01-22T16:16:54","modified_gmt":"2024-01-22T11:16:54","slug":"product-recommendation-based-on-selection-in-javascript","status":"publish","type":"post","link":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/","title":{"rendered":"Product Recommendation Based On Selection in JavaScript"},"content":{"rendered":"<p>This JavaScript code snippet helps you to create product recommendation based on user selection. It captures preferences like type, brand, and price range. The `getRecommendation` function processes these selections and displays product suggestions. It helps suggest items based on specific criteria chosen by the user.<\/p>\n<p>You can use this code on websites for product recommendations. It helps users find relevant items based on their preferences, improving their shopping experience.<\/p>\n<h2>How to Create Product Recommendation Based On Selection in JavaScript<\/h2>\n<p>1. Copy the following HTML code into your project. It includes a form with <a href=\"https:\/\/codehim.com\/text-input\/custom-select-dropdown-css-only\/\" target=\"_blank\" rel=\"noopener\">dropdowns<\/a> for product type and brand, a price range slider, and a &#8220;Get Recommendation&#8221; button.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;div class=\"container\"&gt;\r\n    &lt;h1&gt;Product Recommendation&lt;\/h1&gt;\r\n\r\n    &lt;form id=\"productForm\" onsubmit=\"getRecommendation(); return false;\"&gt;\r\n        &lt;label for=\"productType\"&gt;Product Type:&lt;\/label&gt;\r\n        &lt;select id=\"productType\"&gt;\r\n            &lt;option value=\"laptop\"&gt;Laptop&lt;\/option&gt;\r\n            &lt;option value=\"phone\"&gt;Phone&lt;\/option&gt;\r\n            &lt;option value=\"camera\"&gt;Camera&lt;\/option&gt;\r\n            &lt;!-- Add more product types as needed --&gt;\r\n        &lt;\/select&gt;\r\n\r\n        &lt;label for=\"brandName\"&gt;Brand Name:&lt;\/label&gt;\r\n        &lt;select id=\"brandName\"&gt;\r\n            &lt;option value=\"apple\"&gt;Apple&lt;\/option&gt;\r\n            &lt;option value=\"samsung\"&gt;Samsung&lt;\/option&gt;\r\n            &lt;option value=\"sony\"&gt;Sony&lt;\/option&gt;\r\n            &lt;!-- Add more brand names as needed --&gt;\r\n        &lt;\/select&gt;\r\n\r\n        &lt;label for=\"priceRange\"&gt;Price Range:&lt;\/label&gt;\r\n        &lt;input type=\"range\" id=\"priceRange\" min=\"0\" max=\"1000\" step=\"50\" value=\"500\"&gt;\r\n        &lt;span id=\"priceValue\"&gt;500&lt;\/span&gt;\r\n\r\n        &lt;button type=\"submit\"&gt;Get Recommendation&lt;\/button&gt;\r\n    &lt;\/form&gt;\r\n\r\n    &lt;div id=\"recommendationResult\" class=\"result-container\"&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>2. Paste the following CSS code to make your form visually appealing. Feel free to customize the styles according to your website&#8217;s design.<\/p>\n<pre class=\"prettyprint linenums lang-css\">body {\r\n    font-family: 'Arial', sans-serif;\r\n    margin: 0;\r\n    padding: 0;\r\n    background-color: #f5f5f5;\r\n}\r\n\r\n.container {\r\n    max-width: 800px;\r\n    margin: 50px auto;\r\n    background-color: #fff;\r\n    padding: 20px;\r\n    border-radius: 8px;\r\n    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\r\n}\r\n\r\nh1 {\r\n    text-align: center;\r\n    margin-bottom: 20px;\r\n}\r\n\r\nform {\r\n    display: flex;\r\n    flex-wrap: wrap;\r\n    justify-content: space-between;\r\n    margin-bottom: 20px;\r\n}\r\n\r\nlabel {\r\n    margin-bottom: 10px;\r\n}\r\n\r\nselect,\r\ninput[type=\"range\"] {\r\n    width: calc(33.33% - 10px);\r\n    padding: 8px;\r\n    margin-bottom: 10px;\r\n    border: 1px solid #ddd;\r\n    border-radius: 4px;\r\n}\r\n\r\ninput[type=\"range\"] {\r\n    width: calc(66.66% - 10px);\r\n    margin-bottom: 0;\r\n}\r\n\r\nbutton {\r\n    width: 100%;\r\n    padding: 10px;\r\n    background-color: #4caf50;\r\n    color: #fff;\r\n    border: none;\r\n    border-radius: 4px;\r\n    cursor: pointer;\r\n}\r\n\r\nbutton:hover {\r\n    background-color: #45a049;\r\n}\r\n\r\n#recommendationResult {\r\n    margin-top: 20px;\r\n}\r\n\r\n.result-container {\r\n    padding: 10px;\r\n    border: 1px solid #ddd;\r\n    border-radius: 4px;\r\n}<\/pre>\n<p>3. Finally, add the following JavaScript code to capture user selections and generate product recommendations. The <code>getRecommendation<\/code> function retrieves values from the form, calls <code>generateHardcodedRecommendations<\/code> (replace with your logic or API call), and displays the results using <code>displayRecommendations<\/code>.<\/p>\n<pre class=\"prettyprint linenums lang-js\">function getRecommendation() {\r\n    \/\/ Get selected values from the form\r\n    const productType = document.getElementById('productType').value;\r\n    const brandName = document.getElementById('brandName').value;\r\n    const priceRange = document.getElementById('priceRange').value;\r\n\r\n    \/\/ Replace this with your logic or API call to get recommendations\r\n    const recommendations = generateHardcodedRecommendations(productType, brandName, priceRange);\r\n\r\n    \/\/ Display recommendations\r\n    displayRecommendations(recommendations);\r\n}\r\n\r\nfunction generateHardcodedRecommendations(productType, brandName, priceRange) {\r\n    \/\/ Replace this with your logic or API call to generate recommendations\r\n    \/\/ For demonstration purposes, using hardcoded recommendations\r\n    const recommendations = [\r\n        { name: 'Product 1', type: productType, brand: brandName, price: priceRange },\r\n        { name: 'Product 2', type: productType, brand: brandName, price: priceRange },\r\n        { name: 'Product 3', type: productType, brand: brandName, price: priceRange }\r\n    ];\r\n\r\n    return recommendations;\r\n}\r\n\r\nfunction displayRecommendations(recommendations) {\r\n    const resultContainer = document.getElementById('recommendationResult');\r\n    resultContainer.innerHTML = '';\r\n\r\n    if (recommendations.length === 0) {\r\n        resultContainer.innerHTML = '&lt;p&gt;No recommendations found.&lt;\/p&gt;';\r\n    } else {\r\n        recommendations.forEach(product =&gt; {\r\n            const productCard = document.createElement('div');\r\n            productCard.classList.add('result-container');\r\n\r\n            const details = document.createElement('p');\r\n            details.innerHTML = `&lt;strong&gt;Name:&lt;\/strong&gt; ${product.name}&lt;br&gt;\r\n                                 &lt;strong&gt;Type:&lt;\/strong&gt; ${product.type}&lt;br&gt;\r\n                                 &lt;strong&gt;Brand:&lt;\/strong&gt; ${product.brand}&lt;br&gt;\r\n                                 &lt;strong&gt;Price:&lt;\/strong&gt; ${product.price}`;\r\n\r\n            productCard.appendChild(details);\r\n            resultContainer.appendChild(productCard);\r\n        });\r\n    }\r\n}<\/pre>\n<p>Replace the <code>generateHardcodedRecommendations<\/code> function with your recommendation logic or API call. This is where you can implement personalized algorithms to fetch real-time suggestions.<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created a Product Recommendation Based on Selection on your website. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code snippet helps you to create product recommendation based on user selection. It captures preferences like type, brand,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":10103,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[116],"tags":[],"class_list":["post-10083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vanilla-javascript"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Product Recommendation Based On Selection in JavaScript &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Product Recommendation Based On Selection in JavaScript &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-19T18:14:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:16:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Product Recommendation Based On Selection in JavaScript\",\"datePublished\":\"2024-01-19T18:14:00+00:00\",\"dateModified\":\"2024-01-22T11:16:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\"},\"wordCount\":222,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png\",\"articleSection\":[\"Vanilla JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\",\"url\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\",\"name\":\"Product Recommendation Based On Selection in JavaScript &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png\",\"datePublished\":\"2024-01-19T18:14:00+00:00\",\"dateModified\":\"2024-01-22T11:16:54+00:00\",\"description\":\"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png\",\"width\":1280,\"height\":960,\"caption\":\"Product Recommendation Based On Selection in JavaScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vanilla JavaScript\",\"item\":\"https:\/\/codehim.com\/category\/vanilla-javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Product Recommendation Based On Selection in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Product Recommendation Based On Selection in JavaScript &#8212; CodeHim","description":"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.","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:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Product Recommendation Based On Selection in JavaScript &#8212; CodeHim","og_description":"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-19T18:14:00+00:00","article_modified_time":"2024-01-22T11:16:54+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Product Recommendation Based On Selection in JavaScript","datePublished":"2024-01-19T18:14:00+00:00","dateModified":"2024-01-22T11:16:54+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/"},"wordCount":222,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png","articleSection":["Vanilla JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/","url":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/","name":"Product Recommendation Based On Selection in JavaScript &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png","datePublished":"2024-01-19T18:14:00+00:00","dateModified":"2024-01-22T11:16:54+00:00","description":"Here is a free code snippet to create a Product Recommendation Based On Selection in JavaScript. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/12\/Product-Recommendation-Based-On-Selection-in-JavaScript.png","width":1280,"height":960,"caption":"Product Recommendation Based On Selection in JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/vanilla-javascript\/product-recommendation-based-on-selection-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Vanilla JavaScript","item":"https:\/\/codehim.com\/category\/vanilla-javascript\/"},{"@type":"ListItem","position":3,"name":"Product Recommendation Based On Selection in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":953,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/10083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=10083"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/10083\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/10103"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=10083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=10083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=10083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}