|
| 1 | +--- |
| 2 | +title: Docs recommendation form |
| 3 | +description: Get a customized list of the docs you should read for your use case. |
| 4 | +linkTitle: Doc recommendation |
| 5 | +--- |
| 6 | + |
| 7 | +# Find the docs you need to get started |
| 8 | + |
| 9 | +Welcome! Answer the questions below to find the docs that best fit your needs. |
| 10 | + |
| 11 | +<div id="recommendationForm"> |
| 12 | + <form id="productForm"> |
| 13 | + <div class="question"> |
| 14 | + <p>1. What is your main purpose for using the documentation?</p> |
| 15 | + <label><input type="radio" name="purpose" value="a"> Casual use</label><br> |
| 16 | + <label><input type="radio" name="purpose" value="b"> Professional work</label><br> |
| 17 | + <label><input type="radio" name="purpose" value="c"> Learning</label><br> |
| 18 | + </div> |
| 19 | + |
| 20 | + <div class="question"> |
| 21 | + <p>2. What is your operating system?</p> |
| 22 | + <label><input type="radio" name="budget" value="a"> Linux</label><br> |
| 23 | + <label><input type="radio" name="budget" value="b"> macOS</label><br> |
| 24 | + <label><input type="radio" name="budget" value="c"> Windows</label><br> |
| 25 | + </div> |
| 26 | + |
| 27 | + <div class="question"> |
| 28 | + <p>3. Which feature is most important to you?</p> |
| 29 | + <label><input type="radio" name="feature" value="a"> Search</label><br> |
| 30 | + <label><input type="radio" name="feature" value="b"> JSON</label><br> |
| 31 | + <label><input type="radio" name="feature" value="c"> Time series</label><br> |
| 32 | + </div> |
| 33 | + |
| 34 | + <button type="button" onclick="recommendProduct()">Get Recommendation</button> |
| 35 | + </form> |
| 36 | + <div id="recommendationResult"></div> |
| 37 | +</div> |
| 38 | + |
| 39 | +<script> |
| 40 | +function recommendProduct() { |
| 41 | + const purpose = document.querySelector('input[name="purpose"]:checked'); |
| 42 | + const budget = document.querySelector('input[name="budget"]:checked'); |
| 43 | + const feature = document.querySelector('input[name="feature"]:checked'); |
| 44 | + |
| 45 | + if (!purpose || !budget || !feature) { |
| 46 | + alert("Please answer all questions!"); |
| 47 | + return; |
| 48 | + } |
| 49 | + |
| 50 | + let recommendation = ""; |
| 51 | + |
| 52 | + if (purpose.value === 'a' && budget.value === 'a') { |
| 53 | + recommendation = "Product A - Perfect for casual use within your budget!"; |
| 54 | + } else if (purpose.value === 'b' && feature.value === 'b') { |
| 55 | + recommendation = "Product B - Ideal for professional work with great processing power!"; |
| 56 | + } else if (purpose.value === 'c' && feature.value === 'c') { |
| 57 | + recommendation = "Product C - Great for gaming with an amazing display!"; |
| 58 | + } else { |
| 59 | + recommendation = "Product D - A versatile choice that meets most needs."; |
| 60 | + } |
| 61 | + |
| 62 | + document.getElementById("recommendationResult").innerHTML = `<p>We recommend: <strong>${recommendation}</strong></p>`; |
| 63 | +} |
| 64 | +</script> |
| 65 | + |
| 66 | +<style> |
| 67 | +#recommendationForm { |
| 68 | + margin: 20px; |
| 69 | +} |
| 70 | + |
| 71 | +.question { |
| 72 | + margin-bottom: 15px; |
| 73 | +} |
| 74 | + |
| 75 | +#recommendationResult p { |
| 76 | + font-weight: bold; |
| 77 | + color: #0056b3; |
| 78 | +} |
| 79 | +</style> |
0 commit comments