Calories Calculator by Weight

Calories Calculator by Weight | Daily Calorie Needs Estimator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –card-bg: #fff; –shadow: 0 4px 12px rgba(0, 0, 0, 0.08); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; min-height: 100vh; } .container { width: 100%; max-width: 960px; margin: 20px auto; padding: 20px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); box-sizing: border-box; } h1, h2, h3 { color: var(–primary-color); text-align: center; } h1 { font-size: 2.5em; margin-bottom: 10px; } h2 { font-size: 1.8em; margin-top: 30px; margin-bottom: 20px; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; } h3 { font-size: 1.4em; margin-top: 25px; margin-bottom: 15px; } .calculator-wrapper { background-color: var(–card-bg); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-bottom: 40px; } .input-group { margin-bottom: 20px; display: flex; flex-direction: column; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: 100%; padding: 12px; border: 1px solid var(–border-color); border-radius: 4px; box-sizing: border-box; font-size: 1em; } .input-group input[type="number"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .input-group small { font-size: 0.85em; color: #6c757d; margin-top: 5px; display: block; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .buttons-container { display: flex; justify-content: space-between; margin-top: 25px; gap: 10px; } button { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; flex-grow: 1; } button.primary { background-color: var(–primary-color); color: white; } button.primary:hover { background-color: #003366; transform: translateY(-2px); } button.secondary { background-color: #6c757d; color: white; } button.secondary:hover { background-color: #5a6268; transform: translateY(-2px); } #results { margin-top: 30px; padding: 25px; border: 1px dashed var(–primary-color); border-radius: 8px; background-color: var(–card-bg); text-align: center; } #results h3 { margin-top: 0; margin-bottom: 15px; color: var(–primary-color); } .result-item { margin-bottom: 15px; font-size: 1.1em; } .result-item strong { color: var(–primary-color); display: inline-block; min-width: 200px; /* For alignment */ } .main-result { font-size: 1.8em; font-weight: bold; color: var(–success-color); margin-top: 15px; padding: 15px; border-radius: 6px; background-color: rgba(40, 167, 69, 0.1); display: inline-block; min-width: 250px; } .formula-explanation { font-size: 0.9em; color: #6c757d; margin-top: 20px; padding: 10px; background-color: #e9ecef; border-radius: 4px; text-align: left; } .formula-explanation strong { color: var(–primary-color); } .chart-container { margin-top: 40px; padding: 20px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); } canvas { width: 100% !important; height: auto !important; display: block; margin: 0 auto; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 15px; caption-side: top; text-align: center; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { border: 1px solid var(–border-color); padding: 12px; text-align: left; } th { background-color: var(–primary-color); color: white; font-weight: bold; } tr:nth-child(even) { background-color: #f2f2f2; } .article-content { width: 100%; max-width: 960px; margin: 30px auto 0; padding: 20px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); box-sizing: border-box; } .article-content p { margin-bottom: 15px; } .article-content a { color: var(–primary-color); text-decoration: none; } .article-content a:hover { text-decoration: underline; } .faq-section .faq-item { margin-bottom: 20px; padding: 15px; border: 1px solid var(–border-color); border-radius: 5px; background-color: #fdfdfd; } .faq-section .faq-item h4 { margin-top: 0; margin-bottom: 10px; color: var(–primary-color); cursor: pointer; position: relative; padding-left: 25px; } .faq-section .faq-item h4::before { content: '+'; position: absolute; left: 5px; font-size: 1.2em; font-weight: bold; color: var(–primary-color); } .faq-section .faq-item.open h4::before { content: '-'; } .faq-section .faq-item p { display: none; margin-top: 10px; margin-bottom: 0; padding-left: 15px; border-left: 2px solid var(–primary-color); } .faq-section .faq-item.open p { display: block; } #related-tools ul { list-style: none; padding: 0; } #related-tools li { margin-bottom: 10px; } #related-tools a { font-weight: bold; } #related-tools span { font-size: 0.9em; color: #6c757d; margin-left: 10px; } .summary-text { font-size: 1.1em; text-align: center; margin-bottom: 25px; font-style: italic; color: #555; } .copy-button { background-color: var(–primary-color); color: white; margin-left: 10px; font-size: 0.9em; padding: 8px 15px; flex-grow: 0; } .copy-button:hover { background-color: #003366; } /* Responsive adjustments */ @media (max-width: 768px) { h1 { font-size: 2em; } h2 { font-size: 1.5em; } .container, .calculator-wrapper, .article-content { margin: 15px; padding: 20px; } .buttons-container { flex-direction: column; } button { width: 100%; margin-bottom: 10px; } button.copy-button { width: auto; margin-left: 0; margin-top: 10px; } .main-result { font-size: 1.5em; min-width: auto; width: 100%; } .result-item strong { min-width: auto; display: block; margin-bottom: 5px; } }

Calories Calculator by Weight

Estimate your daily calorie needs based on your body weight and activity level. Get personalized insights for your health and fitness goals.

Daily Calorie Needs Calculator

Enter your weight in kilograms (kg).
Sedentary (little or no exercise) Lightly active (light exercise/sports 1-3 days/week) Moderately active (moderate exercise/sports 3-5 days/week) Very active (hard exercise/sports 6-7 days a week) Extra active (very hard exercise/sports & physical job) Select your typical weekly physical activity level.
Maintain Weight Lose Weight (0.5 kg/week) Gain Weight (0.5 kg/week) Choose your desired weight management goal.

Your Estimated Daily Calorie Needs

Basal Metabolic Rate (BMR): kcal
Calories for Activity: kcal
Calories for Weight Goal: kcal
Formula Used:

1. BMR (Basal Metabolic Rate) Estimation: While the Mifflin-St Jeor equation is common for BMR, this calculator uses a simplified weight-based estimation for demonstration: BMR ≈ Weight (kg) * 22. This is a general approximation.

2. Total Daily Energy Expenditure (TDEE): BMR * Activity Level Factor.

3. Calorie Goal Adjustment: For weight loss or gain, approximately 500 kcal are added or subtracted daily (for a target of +/- 0.5 kg per week).

Daily Calorie Needs vs. Weight Goal
Metric Value Description
Basal Metabolic Rate (BMR) — kcal Calories burned at rest.
Activity Calories — kcal Calories burned through daily activity.
Weight Goal Adjustment — kcal Adjustment for desired weight gain or loss.
Total Daily Calories (TDEE) — kcal Estimated total calories to meet your goal.

{primary_keyword}

A calories calculator by weight is a digital tool designed to estimate the number of calories an individual needs to consume daily to maintain, lose, or gain weight. This calculation is primarily driven by the user's body weight, but also considers other crucial factors like age, sex, height, and activity level. Understanding your daily calorie target is fundamental for effective weight management, whether your goal is to shed unwanted pounds, build muscle mass, or simply maintain your current physique. It's a cornerstone of many fitness and health programs, providing a quantifiable metric to guide dietary choices.

Who should use it? Anyone looking to manage their weight effectively can benefit from a calories calculator by weight. This includes:

  • Individuals aiming for weight loss.
  • People seeking to gain weight or muscle mass.
  • Athletes and fitness enthusiasts fine-tuning their nutrition.
  • Those simply curious about their energy expenditure and needs.
  • People recovering from illness or injury who need to adjust caloric intake.

Common misconceptions about calorie calculations often revolve around the idea that calorie counting is the *only* factor in weight management. While total calories in versus calories out is a significant principle, the *quality* of those calories (nutrient density, macronutrient balance), hormonal responses, metabolism, and individual physiological differences also play vital roles. Another misconception is that calorie needs are static; they fluctuate based on activity, stress, sleep, and even environmental temperature. Our calories calculator by weight provides an estimate, a starting point for personalized dietary strategies.

{primary_keyword} Formula and Mathematical Explanation

The most widely accepted formulas for calculating calorie needs involve estimating Basal Metabolic Rate (BMR) and then factoring in activity level to determine Total Daily Energy Expenditure (TDEE). While this calculator uses a simplified weight-based estimation for BMR (Weight in kg * 22) for ease of use and demonstration, more precise methods like the Mifflin-St Jeor or Harris-Benedict equations are commonly used in clinical settings.

Here's a breakdown of the general process and the variables involved:

1. Basal Metabolic Rate (BMR) Estimation

BMR is the number of calories your body burns at rest to maintain basic functions like breathing, circulation, and cell production. A common simplified estimation based on weight is:

BMR ≈ Weight (kg) * 22

2. Total Daily Energy Expenditure (TDEE) Calculation

TDEE accounts for the calories burned through physical activity. It's calculated by multiplying your BMR by an Activity Level Factor:

TDEE = BMR * Activity Level Factor

3. Calorie Goal Adjustment

To achieve weight loss or gain, a caloric deficit or surplus is needed. A common target for a moderate weight change (around 0.5 kg or 1 lb per week) is a deficit or surplus of approximately 500 calories per day.

Goal Calories = TDEE + (Weight Goal Adjustment in kcal)

  • Maintain Weight: Adjustment = 0 kcal
  • Lose Weight: Adjustment ≈ -500 kcal
  • Gain Weight: Adjustment ≈ +500 kcal

Variables Table

Variable Meaning Unit Typical Range / Options
Weight Body mass of the individual. Kilograms (kg) ≥ 30 kg, ≤ 300 kg
Activity Level Factor Multiplier representing daily physical activity. Unitless 1.2 (Sedentary) to 1.9 (Extra active)
Weight Goal Desired outcome for body weight. Categorical Maintain, Lose, Gain
BMR Calories burned at rest. Kilocalories (kcal) Varies significantly by weight, age, sex.
TDEE Total calories burned daily including activity. Kilocalories (kcal) Varies significantly.
Goal Calories Target daily calorie intake for specific weight goal. Kilocalories (kcal) Varies significantly.

Practical Examples (Real-World Use Cases)

Let's illustrate how the calories calculator by weight works with practical scenarios:

Example 1: Weight Loss Goal

  • User Profile: Sarah, who weighs 75 kg, is moderately active (exercises 3-5 days a week), and wants to lose weight.

Inputs:

  • Weight: 75 kg
  • Activity Level: Moderately active (Factor = 1.55)
  • Weight Goal: Lose Weight

Calculations:

  • BMR ≈ 75 kg * 22 = 1650 kcal
  • TDEE = 1650 kcal * 1.55 = 2557.5 kcal
  • Goal Calories = 2557.5 kcal – 500 kcal = 2057.5 kcal

Results:

  • BMR: ~1650 kcal
  • Activity Calories: ~2558 kcal (This is TDEE in this simplified model for display purposes, before goal adjustment)
  • Calories for Weight Goal: ~2058 kcal
  • Main Result: 2058 kcal

Interpretation: Sarah should aim to consume approximately 2058 calories per day to achieve a weight loss of about 0.5 kg per week. Consistent adherence to this target, combined with her moderate activity, is key.

Example 2: Weight Gain Goal

  • User Profile: Mark, who weighs 68 kg, is lightly active (exercises 1-3 days a week), and wants to gain muscle mass.

Inputs:

  • Weight: 68 kg
  • Activity Level: Lightly active (Factor = 1.375)
  • Weight Goal: Gain Weight

Calculations:

  • BMR ≈ 68 kg * 22 = 1496 kcal
  • TDEE = 1496 kcal * 1.375 = 2057 kcal
  • Goal Calories = 2057 kcal + 500 kcal = 2557 kcal

Results:

  • BMR: ~1496 kcal
  • Activity Calories: ~2057 kcal (TDEE before goal adjustment)
  • Calories for Weight Goal: ~2557 kcal
  • Main Result: 2557 kcal

Interpretation: Mark should aim for around 2557 calories daily to support muscle gain. A balanced diet rich in protein and carbohydrates, combined with strength training, will be crucial for effective muscle development.

How to Use This {primary_keyword} Calculator

Using our calories calculator by weight is straightforward. Follow these steps for an accurate estimate:

  1. Enter Your Weight: Input your current body weight in kilograms (kg) into the 'Body Weight' field. Ensure accuracy for the best results.
  2. Select Your Activity Level: Choose the option that best describes your typical weekly physical activity from the 'Activity Level' dropdown menu. Be honest about your exercise frequency and intensity.
  3. Choose Your Weight Goal: Select whether you want to 'Maintain Weight', 'Lose Weight', or 'Gain Weight' from the 'Weight Goal' dropdown. The calculator will adjust the targets accordingly.
  4. Calculate: Click the 'Calculate Calories' button.

How to Read Results:

  • BMR (Basal Metabolic Rate): This is the minimum calories your body needs at complete rest.
  • Calories for Activity: This represents your estimated TDEE, factoring in your BMR and activity level.
  • Calories for Weight Goal: This is the final recommended daily calorie intake to achieve your specified weight goal (loss, gain, or maintenance). This is the primary result highlighted.
  • The Table and Chart: Provide a visual breakdown and comparison of the different calorie components.

Decision-Making Guidance: Use the 'Goal Calories' as your daily target. Remember that this is an estimate. Listen to your body, monitor your progress, and adjust your intake as needed. Consider consulting a healthcare professional or registered dietitian for personalized dietary advice, especially if you have underlying health conditions. For weight loss, focus on nutrient-dense foods and consistent exercise. For weight gain, prioritize sufficient protein intake and strength training alongside a caloric surplus.

Key Factors That Affect {primary_keyword} Results

While our calories calculator by weight provides a solid estimate, several factors can influence your actual daily calorie needs. Understanding these nuances can help you fine-tune your dietary approach:

  1. Age: Metabolism naturally tends to slow down with age, meaning older individuals may require fewer calories than younger ones with similar weight and activity levels.
  2. Sex: Biological sex plays a role, as men generally have more muscle mass and a higher metabolic rate than women, thus requiring more calories.
  3. Body Composition: Muscle tissue burns more calories at rest than fat tissue. Someone with a higher percentage of lean muscle mass will have a higher BMR than someone of the same weight with more body fat.
  4. Hormonal Factors: Conditions like thyroid issues (hypothyroidism or hyperthyroidism) can significantly impact metabolism and calorie requirements. Hormonal fluctuations during menstruation or menopause can also influence energy needs.
  5. Genetics: Individual genetic makeup influences metabolic rate and how efficiently the body uses and stores energy. Some people are naturally predisposed to a faster metabolism.
  6. Dietary Thermogenesis (TEF): The thermic effect of food (TEF) refers to the calories burned during digestion, absorption, and metabolism of food. Protein has a higher TEF than carbohydrates or fats, meaning it requires more energy to process.
  7. Environmental Factors: Extreme temperatures can influence calorie expenditure. Your body may burn more calories to maintain core body temperature in very cold or very hot environments.
  8. Sleep Quality and Stress: Poor sleep and chronic stress can disrupt hormones that regulate appetite and metabolism, potentially affecting calorie needs and weight management.

Frequently Asked Questions (FAQ)

What is the difference between BMR and TDEE?

BMR (Basal Metabolic Rate) is the calories your body burns at complete rest. TDEE (Total Daily Energy Expenditure) includes BMR plus the calories burned from all physical activities, including exercise and non-exercise activity thermogenesis (NEAT).

How accurate is a calories calculator by weight?

These calculators provide an estimate based on established formulas. Individual metabolism, genetics, body composition, and hormonal factors can cause actual needs to vary. They are excellent starting points but not definitive measures.

Can I use this calculator if I have a specific medical condition?

This calculator is intended for general informational purposes and is not a substitute for professional medical advice. If you have medical conditions (e.g., thyroid disorders, diabetes, eating disorders), consult your doctor or a registered dietitian before making significant dietary changes.

How much weight can I expect to lose or gain per week with the calculator's recommendation?

The calculator assumes a deficit or surplus of approximately 500 calories per day for a weight loss or gain of about 0.5 kg (1 lb) per week. Actual results can vary.

Should I adjust my calorie intake if I start a new exercise routine?

Yes, if your activity level changes significantly, you should recalculate your TDEE using the updated activity level in the calories calculator by weight to ensure your intake aligns with your goals.

What is NEAT?

NEAT stands for Non-Exercise Activity Thermogenesis. It includes calories burned from activities that are not formal exercise, such as walking to work, fidgeting, typing, doing chores, and standing.

Is it better to eat fewer calories or exercise more for weight loss?

A combination of both is typically most effective and sustainable. Reducing calorie intake creates a deficit, while exercise burns additional calories, improves cardiovascular health, builds muscle, and boosts metabolism.

Why does my weight fluctuate daily even if I stick to my calorie goal?

Daily weight fluctuations are normal and can be caused by water retention, food volume, hormonal cycles, and digestive processes. Focus on weekly trends rather than daily changes.

© 2023 Your Website Name. All rights reserved.

var weightInput = document.getElementById('weight'); var activityLevelSelect = document.getElementById('activityLevel'); var goalSelect = document.getElementById('goal'); var bmrResultSpan = document.getElementById('bmrResult'); var activityCaloriesResultSpan = document.getElementById('activityCaloriesResult'); var goalCaloriesResultSpan = document.getElementById('goalCaloriesResult'); var totalCaloriesResultDiv = document.getElementById('totalCaloriesResult'); var resultsDiv = document.getElementById('results'); var bmrTableTd = document.getElementById('bmrTable'); var activityCalTableTd = document.getElementById('activityCalTable'); var goalCalTableTd = document.getElementById('goalCalTable'); var tdeeTableTd = document.getElementById('tdeeTable'); var weightErrorDiv = document.getElementById('weightError'); var chartCanvas = document.getElementById('calorieChart').getContext('2d'); var chartInstance = null; var defaultWeight = 70; var defaultActivityLevel = '1.55'; var defaultGoal = 'maintain'; function validateInput(value, elementId, errorElementId, min, max, message) { var errorElement = document.getElementById(errorElementId); errorElement.style.display = 'none'; if (value === "") { errorElement.innerText = "This field is required."; errorElement.style.display = 'block'; return false; } var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.innerText = "Please enter a valid number."; errorElement.style.display = 'block'; return false; } if (numValue max) { errorElement.innerText = message; errorElement.style.display = 'block'; return false; } return true; } function calculateCalories() { var weight = weightInput.value; var activityLevelFactor = parseFloat(activityLevelSelect.value); var goal = goalSelect.value; var isWeightValid = validateInput(weight, 'weight', 'weightError', 30, 300, 'Weight must be between 30 and 300 kg.'); if (!isWeightValid) { return; } weight = parseFloat(weight); var bmr = weight * 22; // Simplified BMR estimation var activityCalories = bmr * activityLevelFactor; // This is TDEE var goalAdjustment = 0; if (goal === 'lose') { goalAdjustment = -500; } else if (goal === 'gain') { goalAdjustment = 500; } var totalCalories = activityCalories + goalAdjustment; // Ensure no negative calorie targets, minimum sensible value around 1200 for loss if (totalCalories < 1200 && goal === 'lose') { totalCalories = 1200; goalAdjustment = totalCalories – activityCalories; // Recalculate adjustment } if (totalCalories 1.5) { // Slightly higher floor for gain if very active totalCalories = 1800; goalAdjustment = totalCalories – activityCalories; } bmrResultSpan.textContent = bmr.toFixed(0); activityCaloriesResultSpan.textContent = activityCalories.toFixed(0); goalCaloriesResultSpan.textContent = goalAdjustment.toFixed(0); totalCaloriesResultDiv.textContent = totalCalories.toFixed(0) + ' kcal'; bmrTableTd.textContent = bmr.toFixed(0) + ' kcal'; activityCalTableTd.textContent = activityCalories.toFixed(0) + ' kcal'; goalCalTableTd.textContent = goalAdjustment.toFixed(0) + ' kcal'; tdeeTableTd.textContent = '' + totalCalories.toFixed(0) + ' kcal'; resultsDiv.style.display = 'block'; updateChart(bmr, activityCalories, totalCalories); } function resetCalculator() { weightInput.value = defaultWeight; activityLevelSelect.value = defaultActivityLevel; goalSelect.value = defaultGoal; weightErrorDiv.style.display = 'none'; resultsDiv.style.display = 'none'; if (chartInstance) { chartInstance.destroy(); chartInstance = null; } calculateCalories(); // Recalculate with default values } function copyResults() { var bmr = bmrResultSpan.textContent; var activityCal = activityCaloriesResultSpan.textContent; var goalCal = goalCaloriesResultSpan.textContent; var totalCal = totalCaloriesResultDiv.textContent; var weightVal = weightInput.value; var activityText = activityLevelSelect.options[activityLevelSelect.selectedIndex].text; var goalText = goalSelect.options[goalSelect.selectedIndex].text; var resultText = "— Calorie Needs Estimate —\n\n"; resultText += "Weight: " + weightVal + " kg\n"; resultText += "Activity Level: " + activityText + "\n"; resultText += "Weight Goal: " + goalText + "\n\n"; resultText += "Basal Metabolic Rate (BMR): " + bmr + "\n"; resultText += "Calories for Activity (TDEE): " + activityCal + "\n"; resultText += "Calories for Weight Goal: " + goalCal + "\n"; resultText += "===================================\n"; resultText += "Your Estimated Daily Calorie Needs:\n"; resultText += totalCal + "\n"; resultText += "==================================="; navigator.clipboard.writeText(resultText).then(function() { alert('Results copied to clipboard!'); }).catch(function(err) { console.error('Failed to copy results: ', err); alert('Failed to copy results. Please copy manually.'); }); } function updateChart(bmr, activityCalories, totalCalories) { if (chartInstance) { chartInstance.destroy(); } var ctx = document.getElementById('calorieChart').getContext('2d'); chartInstance = new Chart(ctx, { type: 'bar', data: { labels: ['BMR', 'Activity Burn', 'Target Calories'], datasets: [{ label: 'Calorie Values (kcal)', data: [bmr, activityCalories, totalCalories], backgroundColor: [ 'rgba(0, 74, 153, 0.6)', // BMR 'rgba(40, 167, 69, 0.6)', // Activity Burn (TDEE before goal adjustment) 'rgba(255, 193, 7, 0.6)' // Target Calories ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)', 'rgba(255, 193, 7, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, title: { display: true, text: 'Calories (kcal)' } } }, plugins: { legend: { display: false // Labels are sufficient for 3 bars }, tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y.toFixed(0) + ' kcal'; } return label; } } } } } }); } // Initial calculation on page load document.addEventListener('DOMContentLoaded', function() { resetCalculator(); // Sets default values and calculates }); // Handle input validation on blur weightInput.addEventListener('blur', function() { validateInput(this.value, 'weight', 'weightError', 30, 300, 'Weight must be between 30 and 300 kg.'); calculateCalories(); // Recalculate on blur to update results }); weightInput.addEventListener('input', function() { // Clear error immediately if user starts typing valid input if (this.value === "") { document.getElementById('weightError').style.display = 'none'; } else { var numValue = parseFloat(this.value); if (!isNaN(numValue) && numValue >= 30 && numValue <= 300) { document.getElementById('weightError').style.display = 'none'; } } calculateCalories(); // Live update }); activityLevelSelect.addEventListener('change', calculateCalories); goalSelect.addEventListener('change', calculateCalories); // FAQ Toggle var faqItems = document.querySelectorAll('.faq-item h4'); faqItems.forEach(function(item) { item.addEventListener('click', function() { var parent = this.parentElement; parent.classList.toggle('open'); }); });

Leave a Comment