Diesel Weight to Volume Calculator

Diesel Weight to Volume Calculator: Convert Gallons to Pounds & Vice Versa body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; background-color: #f8f9fa; color: #333; margin: 0; padding: 0; display: flex; justify-content: center; padding: 20px 0; } .container { max-width: 1000px; width: 100%; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; align-items: center; } header { text-align: center; margin-bottom: 30px; width: 100%; } h1 { color: #004a99; margin-bottom: 10px; } .sub-heading { font-size: 1.1em; color: #555; } .loan-calc-container { width: 100%; max-width: 600px; background-color: #e9ecef; padding: 25px; border-radius: 8px; margin-bottom: 30px; box-shadow: inset 0 1px 5px rgba(0,0,0,0.05); } .input-group { margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: #004a99; } .input-group input[type="number"], .input-group select { width: calc(100% – 22px); padding: 10px 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 1em; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group select:focus { border-color: #004a99; outline: none; box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.25); } .input-group small { display: block; margin-top: 5px; font-size: 0.85em; color: #6c757d; } .error-message { color: #dc3545; font-size: 0.8em; margin-top: 5px; min-height: 1.2em; } .btn-group { display: flex; justify-content: space-between; margin-top: 25px; } .btn { padding: 10px 18px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; } .btn-primary { background-color: #004a99; color: white; } .btn-primary:hover { background-color: #003d80; } .btn-secondary { background-color: #6c757d; color: white; } .btn-secondary:hover { background-color: #5a6268; } .results-section { width: 100%; max-width: 600px; margin-top: 30px; padding: 25px; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); } .results-section h2 { color: #004a99; text-align: center; margin-bottom: 20px; font-size: 1.5em; } #primary-result { font-size: 2.5em; font-weight: bold; color: #28a745; background-color: #e9f7f0; padding: 15px; border-radius: 5px; margin-bottom: 20px; text-align: center; word-break: break-all; } .intermediate-results div, .formula-explanation div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #ccc; font-size: 0.95em; } .intermediate-results div:last-child, .formula-explanation div:last-child { border-bottom: none; } .intermediate-results .label, .formula-explanation .label { font-weight: bold; color: #004a99; } .intermediate-results .value, .formula-explanation .value { font-weight: bold; } .formula-explanation { margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee; } .formula-explanation p { margin-bottom: 10px; font-size: 0.9em; color: #555; } .chart-container { width: 100%; max-width: 600px; margin-top: 30px; padding: 25px; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); display: flex; flex-direction: column; align-items: center; } .chart-container h3 { color: #004a99; margin-bottom: 20px; text-align: center; } canvas { max-width: 100%; height: auto; } .table-container { width: 100%; max-width: 600px; margin-top: 30px; padding: 25px; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow-x: auto; } .table-container caption { font-size: 1.2em; font-weight: bold; color: #004a99; margin-bottom: 15px; caption-side: top; text-align: center; } table { width: 100%; border-collapse: collapse; margin-top: 10px; } th, td { border: 1px solid #dee2e6; padding: 10px; text-align: right; } th { background-color: #004a99; color: white; font-weight: bold; } td:first-child { text-align: left; } tr:nth-child(even) { background-color: #f2f2f2; } .article-section { width: 100%; max-width: 1000px; margin-top: 40px; padding: 30px; background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); text-align: left; } .article-section h2 { color: #004a99; margin-bottom: 15px; border-bottom: 2px solid #004a99; padding-bottom: 5px; } .article-section h3 { color: #004a99; margin-top: 25px; margin-bottom: 10px; font-size: 1.3em; } .article-section p { margin-bottom: 15px; color: #333; } .article-section ul, .article-section ol { margin-bottom: 15px; padding-left: 25px; } .article-section li { margin-bottom: 8px; } .article-section a { color: #004a99; text-decoration: none; } .article-section a:hover { text-decoration: underline; } .faq-list .faq-item { margin-bottom: 15px; padding: 10px; background-color: #f9f9f9; border-radius: 4px; border-left: 4px solid #004a99; } .faq-list .faq-item h4 { margin: 0 0 5px 0; color: #004a99; cursor: pointer; font-size: 1.1em; } .faq-list .faq-item p { margin: 0; font-size: 0.95em; color: #555; display: none; /* Hidden by default */ } .faq-list .faq-item.open p { display: block; /* Shown when open */ } .related-links ul { list-style: none; padding: 0; } .related-links li { margin-bottom: 10px; font-size: 1em; } .related-links a { font-weight: bold; } .related-links span { display: block; font-size: 0.9em; color: #666; margin-top: 3px; }

Diesel Weight to Volume Calculator

Convert between diesel volume (gallons) and weight (pounds) accurately.

Enter the numerical value of diesel volume or weight.
Gallons (Volume) Pounds (Weight) Select the unit for your input value.
Ultra Low Sulfur Diesel (ULSD) Biodiesel B100 Heating Oil Jet Fuel (JP-8) Different diesel types have slightly different densities.

Calculation Results

Volume:
Weight:
Density Used:

Formula:

Weight (lbs) = Volume (gallons) × Density (lbs/gallon)

Volume (gallons) = Weight (lbs) / Density (lbs/gallon)

Diesel Weight vs. Volume

Diesel Densities at Standard Conditions (Approximate)
Diesel Type Density (lbs/gallon) Density (kg/L)
Ultra Low Sulfur Diesel (ULSD)8.020.961
Biodiesel B1007.670.920
Heating Oil7.700.923
Jet Fuel (JP-8)6.880.825

What is a Diesel Weight to Volume Calculator?

A diesel weight to volume calculator is a specialized tool designed to accurately convert measurements of diesel fuel between volume (typically in gallons) and weight (typically in pounds). Diesel fuel, like all liquids, has a specific density, which is the ratio of its mass to its volume. This density is not a fixed constant; it can vary slightly based on the type of diesel (e.g., standard diesel, biodiesel blends, heating oil), temperature, and other factors. This calculator simplifies the process of determining how much a certain volume of diesel weighs, or conversely, how much volume a specific weight of diesel occupies.

This tool is indispensable for professionals and individuals involved in the logistics, transportation, storage, and sale of diesel fuel. This includes fleet managers, truck drivers, fuel distributors, farmers, construction companies, and anyone who needs precise fuel quantity measurements for inventory, billing, or operational planning. It helps avoid costly errors that can arise from using incorrect conversion factors or assuming a universal density for all diesel types.

A common misconception is that all diesel fuel weighs the same per gallon. In reality, factors like fuel composition (especially with biodiesel blends) and temperature can cause significant variations. Relying on a single, outdated density figure can lead to inaccuracies in fuel purchasing, inventory management, and transportation weight calculations. The diesel weight to volume calculator addresses this by allowing users to select different diesel types, thereby using more precise, industry-standard density values.

Diesel Weight to Volume Formula and Mathematical Explanation

The core principle behind the diesel weight to volume calculator lies in the concept of density. Density is a fundamental physical property of a substance that describes how much mass is contained within a given volume.

The primary formula used is:

Weight = Volume × Density

Conversely, to find the volume:

Volume = Weight / Density

In the context of this calculator, the units commonly used are:

  • Volume: U.S. Gallons (gal)
  • Weight: Pounds (lbs)

Therefore, the density of diesel fuel needs to be expressed in pounds per gallon (lbs/gal).

Variable Explanations

Variable Meaning Unit Typical Range (for Diesel)
Volume The amount of space diesel fuel occupies. Gallons (gal) 1 – 10,000+ gal
Weight The mass of the diesel fuel, measured under gravity. Pounds (lbs) 8 – 80,000+ lbs
Density The mass of diesel fuel per unit of volume. This is the crucial conversion factor. Pounds per Gallon (lbs/gal) ~6.88 (Jet Fuel) to ~8.02 (ULSD) lbs/gal

The calculator selects an appropriate density value based on the user's chosen diesel type. For example, standard Ultra Low Sulfur Diesel (ULSD) has an approximate density of 8.02 lbs/gallon. If a user inputs 10 gallons of ULSD, the calculator multiplies 10 gallons by 8.02 lbs/gallon to determine the weight: 80.2 lbs.

If the user inputs a weight, say 100 lbs, and selects ULSD, the calculator divides 100 lbs by 8.02 lbs/gallon to find the volume: approximately 12.47 gallons.

The accuracy of the diesel weight to volume calculator hinges on using the correct density. This is why selecting the specific type of diesel is an important input.

Practical Examples (Real-World Use Cases)

Example 1: Fueling a Fleet Truck

A fleet manager needs to order 500 gallons of Ultra Low Sulfur Diesel (ULSD) for their trucks. They need to know the approximate weight of this fuel to ensure their truck's load capacity is not exceeded and for potential billing purposes if weight-based charges apply.

  • Input Value: 500
  • Input Unit: Gallons (Volume)
  • Diesel Type: Ultra Low Sulfur Diesel (ULSD)

Calculation:

Using the density of ULSD (approx. 8.02 lbs/gallon):

Weight = 500 gallons × 8.02 lbs/gallon = 4010 lbs

Results:

  • Primary Result: 4010 lbs
  • Volume: 500 gallons
  • Weight: 4010 lbs
  • Density Used: 8.02 lbs/gallon

Financial Interpretation: The fleet manager now knows that 500 gallons of ULSD weigh approximately 4010 pounds. This information is crucial for payload management and ensures compliance with weight restrictions on roads. If fuel is purchased by weight, this calculation provides a basis for estimation.

Example 2: Estimating Fuel for a Generator

A construction site manager has a diesel generator that consumes fuel at a specific rate. They have a 1000-pound delivery of heating oil arriving and need to estimate how many gallons this will provide for their generator's operational planning.

  • Input Value: 1000
  • Input Unit: Pounds (Weight)
  • Diesel Type: Heating Oil

Calculation:

Using the density of Heating Oil (approx. 7.70 lbs/gallon):

Volume = 1000 lbs / 7.70 lbs/gallon ≈ 129.87 gallons

Results:

  • Primary Result: 129.87 gallons
  • Volume: 129.87 gallons
  • Weight: 1000 lbs
  • Density Used: 7.70 lbs/gallon

Financial Interpretation: The manager can estimate that the 1000-pound delivery will yield approximately 130 gallons of heating oil. This allows them to calculate expected run times for the generator, plan subsequent fuel orders, and verify the quantity received against the purchase order. Understanding the volume helps in managing the generator's fuel tank capacity.

How to Use This Diesel Weight to Volume Calculator

Using the diesel weight to volume calculator is straightforward. Follow these steps to get accurate conversions:

  1. Enter Input Value: In the "Input Value" field, type the numerical quantity of diesel you have or need.
  2. Select Input Unit: Choose whether your input value represents "Gallons (Volume)" or "Pounds (Weight)" using the dropdown menu.
  3. Choose Diesel Type: Select the specific type of diesel from the "Diesel Type" dropdown. This is important because different diesel formulations have different densities, which directly affects the weight-to-volume conversion. Common options include Ultra Low Sulfur Diesel (ULSD), Biodiesel, Heating Oil, and Jet Fuel.
  4. Click Calculate: Press the "Calculate" button. The calculator will process your inputs using the appropriate density factor for the selected diesel type.
  5. Read Results: The calculator will display:
    • The Primary Result (highlighted in green), which is the calculated weight if you input volume, or the calculated volume if you input weight.
    • The intermediate values showing the converted volume, converted weight, and the specific density used in the calculation.
    • A brief explanation of the formula.
  6. Use Copy Results: Click "Copy Results" to easily transfer the main result, intermediate values, and key assumptions (like the density used) to another document or application.
  7. Reset: If you need to start over or clear the fields, click the "Reset" button.

Decision-Making Guidance: This calculator helps you make informed decisions regarding fuel procurement, inventory management, transportation logistics, and ensuring compliance with weight regulations. For instance, knowing the weight of fuel helps in managing vehicle payload limits, while knowing the volume helps in estimating operational run times or tank capacities.

Key Factors That Affect Diesel Weight to Volume Results

While the diesel weight to volume calculator provides accurate conversions based on standard densities, several real-world factors can influence the actual weight and volume of diesel fuel:

  1. Fuel Type and Composition: As seen in the calculator, different types of diesel (ULSD, biodiesel blends like B20 or B100, kerosene, jet fuel) have inherently different molecular structures and compositions, leading to varying densities. Biodiesel, for example, is generally less dense than petroleum-based diesel.
  2. Temperature: This is a significant factor. Most liquids, including diesel, expand when heated and contract when cooled. This means a gallon of diesel will weigh slightly less at a higher temperature (due to expansion) and slightly more at a lower temperature (due to contraction). While this calculator uses standard densities (often at 15°C or 60°F), extreme temperatures can cause noticeable deviations.
  3. Additives and Contaminants: Diesel fuel may contain various additives (like cetane improvers, lubricity agents, cold flow improvers) or contaminants (water, sediment). These can slightly alter the overall density of the fuel, though typically to a lesser extent than major type changes or temperature.
  4. Pressure: While less significant for typical fuel storage and transport compared to temperature, changes in pressure can affect liquid density. This is more relevant in high-pressure industrial applications than standard fueling scenarios.
  5. Measurement Accuracy: The precision of the measuring instruments used for both volume (e.g., dipsticks, flow meters) and weight (e.g., scales) directly impacts the accuracy of your input data and, consequently, the calculated results.
  6. Altitude and Gravity: While density is mass per volume, weight is mass times gravitational acceleration. Variations in gravity (due to altitude or location on Earth) would technically affect the measured weight, but this effect is negligible for practical fuel calculations on Earth. The calculator assumes standard Earth gravity.
  7. Regulatory Standards: Different regions or industries might have specific standards for fuel density or require different testing methods, which could lead to variations in accepted density values.

Understanding these factors helps in appreciating the context of the calculator's results and when more precise, real-time measurements might be necessary for critical operations.

Frequently Asked Questions (FAQ)

What is the standard density of diesel fuel?

The density of standard Ultra Low Sulfur Diesel (ULSD) is typically around 8.02 pounds per U.S. gallon at 60°F (15.6°C). However, this can vary slightly. The calculator uses industry-standard values for different diesel types.

Why does the type of diesel matter for weight and volume calculations?

Different diesel formulations, especially those containing biofuels like biodiesel, have different chemical compositions and molecular structures, resulting in distinct densities. For example, 100% biodiesel (B100) is less dense than petroleum-based ULSD. Using the correct density ensures accurate conversions.

Does temperature affect the weight of diesel fuel?

Yes, temperature significantly affects diesel fuel's density. Diesel expands when heated and contracts when cooled. A gallon of warm diesel weighs less than a gallon of cold diesel. This calculator uses standard densities, but for highly precise measurements in extreme temperatures, adjustments may be needed.

Can I use this calculator for Kerosene or Gasoline?

This calculator is specifically designed for diesel fuels and related products like heating oil and jet fuel, which have densities within a certain range. Kerosene and gasoline have different densities and would require a different calculator.

What's the difference between pounds and kilograms for fuel weight?

Pounds (lbs) and kilograms (kg) are both units of mass (often used interchangeably with weight in everyday contexts). A kilogram is approximately 2.20462 pounds. While this calculator outputs in pounds, many international contexts use kilograms.

How accurate is the density data used in the calculator?

The density values used are standard industry approximations for typical conditions. Actual density can fluctuate based on specific fuel batches, precise temperature, and pressure. For critical applications like precise custody transfer or regulatory compliance, certified measurements are recommended.

What does "Ultra Low Sulfur Diesel (ULSD)" mean?

ULSD refers to diesel fuel with a sulfur content of 15 parts per million (ppm) or less. It's the standard diesel fuel used in most on-road and off-road vehicles and equipment today to meet emissions regulations.

Is it better to buy diesel by volume (gallons) or weight (pounds)?

Typically, diesel fuel is sold by volume (gallons or liters) in most retail and commercial settings. However, large-scale transactions or specific contracts might involve weight. Buying by volume is generally more practical for end-users, while weight might be used for bulk transport or inventory reconciliation where precise mass is needed.

var dieselDensities = { ultra_low_sulfur_diesel: 8.02, // lbs/gallon biodiesel_b100: 7.67, // lbs/gallon heating_oil: 7.70, // lbs/gallon jet_fuel_grade_jp8: 6.88 // lbs/gallon }; function getDensity(dieselType) { return dieselDensities[dieselType] || 8.02; // Default to ULSD } function formatNumber(num) { if (isNaN(num) || num === null || num === undefined) { return "–"; } return num.toFixed(2); } function updateChart(inputVal, inputUnit, density) { var canvas = document.getElementById('dieselChart'); var ctx = canvas.getContext('2d'); canvas.width = canvas.offsetWidth; // Adjust canvas size dynamically canvas.height = 300; // Fixed height var dataPoints = []; var labels = []; var maxVal = Math.max(inputVal * 1.5, 100); // Scale based on input for (var i = 0; i maxVal) maxVal = volume; } // Ensure a point exists for the input value if it's not exactly on a step var inputWeight = (inputUnit === 'gallons') ? inputVal * density : inputVal; var inputVolume = (inputUnit === 'gallons') ? inputVal : inputVal / density; // Add the input value point if it's not already one of the 10 points var foundInputPoint = false; for (var j = 0; j < dataPoints.length; j++) { if (Math.abs(dataPoints[j].x – inputVolume) 0) { dataPoints.push({ x: inputVolume, y: inputWeight }); labels.push(formatNumber(inputVolume)); if (inputVolume > maxVal) maxVal = inputVolume; } // Sort data points by volume for a clean line chart dataPoints.sort(function(a, b) { return a.x – b.x; }); // Generate labels for sorted points var sortedLabels = []; for(var k=0; k < dataPoints.length; k++) { sortedLabels.push(formatNumber(dataPoints[k].x)); } ctx.clearRect(0, 0, canvas.width, canvas.height); var chartHeight = canvas.height – 50; // Space for x-axis labels var chartWidth = canvas.width – 60; // Space for y-axis labels var startX = 50; var startY = canvas.height – 30; // Draw X axis ctx.beginPath(); ctx.moveTo(startX, startY); ctx.lineTo(startX + chartWidth, startY); ctx.strokeStyle = '#ccc'; ctx.stroke(); ctx.fillText('Volume (Gallons)', startX + chartWidth / 2, startY + 20); // Draw Y axis ctx.beginPath(); ctx.moveTo(startX, startY); ctx.lineTo(startX, startY – chartHeight); ctx.stroke(); ctx.fillText('Weight (Pounds)', startX – 40, startY – chartHeight / 2); // Draw Data Series (Weight vs Volume) ctx.beginPath(); ctx.moveTo(startX + (dataPoints[0].x / maxVal) * chartWidth, startY – (dataPoints[0].y / (maxVal * density)) * chartHeight); // Approximate max weight for scaling Y axis ctx.strokeStyle = '#004a99'; ctx.lineWidth = 2; for (var i = 0; i < dataPoints.length; i++) { var xPos = startX + (dataPoints[i].x / maxVal) * chartWidth; var yPos = startY – (dataPoints[i].y / (maxVal * density)) * chartHeight; // Scale Y based on max possible weight if (i === 0) { ctx.moveTo(xPos, yPos); } else { ctx.lineTo(xPos, yPos); } ctx.stroke(); // Draw points ctx.fillStyle = '#004a99'; ctx.beginPath(); ctx.arc(xPos, yPos, 4, 0, Math.PI * 2); ctx.fill(); } // Draw X-axis labels ctx.fillStyle = '#333'; ctx.textAlign = 'center'; for (var i = 0; i startX && xPos = startX && inputXPos = startY – chartHeight && inputYPos <= startY) { ctx.fillStyle = '#28a745'; // Success color ctx.beginPath(); ctx.arc(inputXPos, inputYPos, 6, 0, Math.PI * 2); ctx.fill(); } } function calculateDieselWeightVolume() { var inputValue = parseFloat(document.getElementById('input_value').value); var inputUnit = document.getElementById('input_unit').value; var dieselType = document.getElementById('diesel_type').value; var inputValError = document.getElementById('input_value_error'); inputValError.innerText = ''; // Clear previous errors var isValid = true; if (isNaN(inputValue) || inputValue <= 0) { inputValError.innerText = 'Please enter a valid positive number.'; isValid = false; } if (!isValid) { document.getElementById('primary-result').innerText = "–"; document.getElementById('result_volume_gallons').querySelector('.value').innerText = "–"; document.getElementById('result_weight_pounds').querySelector('.value').innerText = "–"; document.getElementById('result_density').querySelector('.value').innerText = "–"; updateChart(0, 'gallons', 8.02); // Reset chart return; } var density = getDensity(dieselType); var resultVolumeGallons = 0; var resultWeightPounds = 0; var primaryResultText = "–"; if (inputUnit === 'gallons') { resultVolumeGallons = inputValue; resultWeightPounds = inputValue * density; primaryResultText = formatNumber(resultWeightPounds) + " lbs"; } else { // pounds resultWeightPounds = inputValue; resultVolumeGallons = inputValue / density; primaryResultText = formatNumber(resultVolumeGallons) + " gallons"; } document.getElementById('primary-result').innerText = primaryResultText; document.getElementById('result_volume_gallons').querySelector('.value').innerText = formatNumber(resultVolumeGallons) + " gallons"; document.getElementById('result_weight_pounds').querySelector('.value').innerText = formatNumber(resultWeightPounds) + " lbs"; document.getElementById('result_density').querySelector('.value').innerText = formatNumber(density) + " lbs/gallon"; updateChart(inputValue, inputUnit, density); } function resetCalculator() { document.getElementById('input_value').value = ''; document.getElementById('input_unit').value = 'gallons'; document.getElementById('diesel_type').value = 'ultra_low_sulfur_diesel'; document.getElementById('input_value_error').innerText = ''; document.getElementById('primary-result').innerText = "–"; document.getElementById('result_volume_gallons').querySelector('.value').innerText = "–"; document.getElementById('result_weight_pounds').querySelector('.value').innerText = "–"; document.getElementById('result_density').querySelector('.value').innerText = "–"; var canvas = document.getElementById('dieselChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear chart } function copyResults() { var primaryResult = document.getElementById('primary-result').innerText; var volumeResult = document.getElementById('result_volume_gallons').querySelector('.value').innerText; var weightResult = document.getElementById('result_weight_pounds').querySelector('.value').innerText; var densityResult = document.getElementById('result_density').querySelector('.value').innerText; var dieselTypeSelected = document.getElementById('diesel_type').options[document.getElementById('diesel_type').selectedIndex].text; var assumptions = "Assumptions:\n"; assumptions += "- Diesel Type: " + dieselTypeSelected + "\n"; assumptions += "- Density Used: " + densityResult + "\n"; var copyText = "Diesel Weight to Volume Conversion:\n\n"; copyText += "Primary Result: " + primaryResult + "\n"; copyText += "————————–\n"; copyText += "Volume: " + volumeResult + "\n"; copyText += "Weight: " + weightResult + "\n"; copyText += "\n" + assumptions; navigator.clipboard.writeText(copyText).then(function() { // Optional: Show a confirmation message console.log('Results copied to clipboard!'); }).catch(function(err) { console.error('Failed to copy results: ', err); }); } // Initialize chart on load window.onload = function() { var canvas = document.getElementById('dieselChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear chart initially // updateChart(0, 'gallons', 8.02); // Optionally draw an empty chart }; // Handle FAQ toggles var faqItems = document.querySelectorAll('.faq-list .faq-item h4'); for (var i = 0; i < faqItems.length; i++) { faqItems[i].onclick = function() { this.parentElement.classList.toggle('open'); }; }

Leave a Comment