Flat Iron Weight Calculator

Flat Iron Weight Calculator: Calculate Steel Weight Accurately :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –shadow-color: rgba(0, 0, 0, 0.1); –accent-color: #6c757d; –white: #fff; –input-border-color: #ced4da; –error-color: #dc3545; } 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: 20px; display: flex; flex-direction: column; align-items: center; } .container { width: 100%; max-width: 960px; background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-bottom: 30px; text-align: center; } h1, h2, h3 { color: var(–primary-color); margin-bottom: 15px; } h1 { font-size: 2.2em; margin-bottom: 20px; } h2 { font-size: 1.8em; margin-top: 30px; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; text-align: left; } h3 { font-size: 1.4em; margin-top: 20px; text-align: left; } .calc-wrapper { display: flex; flex-direction: column; align-items: center; margin-bottom: 30px; } .loan-calc-container { width: 100%; max-width: 600px; background-color: var(–white); padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); border: 1px solid var(–border-color); text-align: left; } .input-group { margin-bottom: 20px; width: 100%; } .input-group label { display: block; font-weight: bold; margin-bottom: 8px; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { width: calc(100% – 24px); padding: 12px; border: 1px solid var(–input-border-color); border-radius: 5px; box-sizing: border-box; font-size: 1em; transition: border-color 0.3s ease; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { border-color: var(–primary-color); outline: none; } .input-group .helper-text { font-size: 0.85em; color: var(–accent-color); margin-top: 5px; display: block; } .error-message { color: var(–error-color); font-size: 0.85em; margin-top: 5px; height: 1.2em; /* Reserve space for error messages */ } .button-group { display: flex; justify-content: space-between; margin-top: 30px; } button { padding: 12px 20px; border: none; border-radius: 5px; font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; color: var(–white); background-color: var(–primary-color); margin-right: 10px; } button:last-child { margin-right: 0; } button.reset-button { background-color: var(–accent-color); } button.copy-button { background-color: var(–success-color); } button:hover { opacity: 0.9; transform: translateY(-1px); } .results-display { margin-top: 30px; padding: 25px; background-color: #e9ecef; border: 1px solid var(–border-color); border-radius: 8px; text-align: left; width: 100%; box-sizing: border-box; } .results-display h3 { margin-top: 0; color: var(–primary-color); text-align: center; } .primary-result { font-size: 2em; font-weight: bold; color: var(–primary-color); background-color: #d0e2f0; padding: 15px; border-radius: 5px; margin-bottom: 15px; text-align: center; } .intermediate-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 15px; text-align: center; } .intermediate-results div { padding: 10px; background-color: var(–white); border-radius: 5px; border: 1px solid var(–border-color); } .intermediate-results div strong { display: block; font-size: 1.2em; color: var(–primary-color); margin-bottom: 5px; } .formula-explanation { font-size: 0.9em; color: var(–accent-color); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(–border-color); } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 2px 5px var(–shadow-color); } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–border-color); } thead { background-color: var(–primary-color); color: var(–white); } th { font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } caption { caption-side: top; font-weight: bold; font-size: 1.1em; color: var(–primary-color); margin-bottom: 10px; text-align: left; } canvas { display: block; margin: 20px auto; background-color: var(–white); border-radius: 5px; box-shadow: 0 2px 5px var(–shadow-color); } .article-content { width: 100%; max-width: 960px; background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-top: 30px; text-align: left; } .article-content p { margin-bottom: 15px; } .article-content ul, .article-content ol { margin-bottom: 15px; padding-left: 20px; } .article-content li { margin-bottom: 8px; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-section h3 { cursor: pointer; position: relative; padding-left: 25px; margin-bottom: 10px; } .faq-section h3::before { content: "+"; position: absolute; left: 0; color: var(–primary-color); font-size: 1.2em; font-weight: bold; transition: transform 0.3s ease; } .faq-section h3.active::before { content: "-"; transform: rotate(180deg); } .faq-section .answer { display: none; padding-left: 20px; margin-bottom: 15px; font-size: 0.95em; color: var(–accent-color); } .related-tools ul { list-style: none; padding: 0; } .related-tools li { margin-bottom: 10px; } /* Responsive adjustments */ @media (max-width: 768px) { .container, .article-content { padding: 20px; } h1 { font-size: 1.8em; } h2 { font-size: 1.5em; } .primary-result { font-size: 1.6em; } .intermediate-results { grid-template-columns: 1fr; } .button-group { flex-direction: column; align-items: center; } button { width: 100%; margin-right: 0; margin-bottom: 10px; } }

Flat Iron Weight Calculator

Calculate the weight of steel flat bars quickly and accurately for your projects.

Enter the total length of the flat iron bar in millimeters (mm).
Enter the width of the flat iron bar in millimeters (mm).
Enter the thickness of the flat iron bar in millimeters (mm).
Steel (Standard, e.g., Carbon Steel) Aluminum Stainless Steel (304) Brass Bronze Titanium Select the material of the flat iron bar. Density is in kg/m³.

Calculation Results

–.– kg
Volume
–.– L
Length
–.– m
Density
— kg/m³
Formula: Weight = Volume × Density
Volume = (Length × Width × Thickness) / 1000³ (to convert mm³ to m³)
Density is sourced from the selected material.
Detailed Calculation Breakdown
Parameter Input Value Unit
Length mm
Width mm
Thickness mm
Material Density kg/m³
Calculated Volume
Calculated Weight kg

What is a Flat Iron Weight Calculator?

A Flat Iron Weight Calculator is a specialized online tool designed to quickly and accurately determine the weight of steel flat bars, also known as flat iron or rectangular bars. This tool is indispensable for a wide range of professionals involved in metal fabrication, construction, engineering, and procurement. By inputting the dimensions of the flat iron (length, width, and thickness) and selecting the material type, the calculator leverages material density to provide an exact weight, typically in kilograms or pounds. This makes it a crucial component in material estimation, cost calculation, and logistical planning.

Who Should Use a Flat Iron Weight Calculator?

The utility of a flat iron weight calculator extends across several key industries and roles:

  • Engineers and Designers: For structural calculations, load-bearing assessments, and material specification.
  • Fabricators and Welders: To estimate the material needed for custom projects, reducing waste and ensuring accurate quotes.
  • Procurement and Purchasing Departments: To budget for raw materials, negotiate prices, and manage inventory effectively.
  • Construction Professionals: For planning the structural elements of buildings, bridges, and other infrastructure projects where flat bars are used.
  • Machinists: To determine the weight of stock material for machining operations, aiding in handling and setup.
  • DIY Enthusiasts and Hobbyists: For smaller projects requiring metal components, helping to plan purchases and understand material properties.

Common Misconceptions about Flat Iron Weight

Several misconceptions can lead to errors in material estimation:

  • Assuming all "steel" weighs the same: Different steel alloys have slightly different densities, impacting the final weight. Our calculator accounts for this by allowing selection of common material types.
  • Inaccurate unit conversions: Confusing millimeters, meters, and kilograms can lead to significant calculation errors. The tool ensures consistent unit handling.
  • Ignoring the impact of thickness: Even small variations in thickness can add up to substantial weight differences over long lengths.
  • Overestimating or underestimating material needs: Without a precise weight calculation, professionals might order too much or too little material, leading to increased costs or project delays.

Flat Iron Weight Formula and Mathematical Explanation

The calculation of flat iron weight is a straightforward application of fundamental physics principles, primarily involving volume and density. The core formula is:

Weight = Volume × Density

To apply this, we first need to calculate the volume of the flat iron bar. Since a flat iron bar is essentially a rectangular prism, its volume is calculated as:

Volume = Length × Width × Thickness

However, it's crucial to ensure all dimensions are in consistent units before calculation. Typically, flat iron dimensions are provided in millimeters (mm), while density is usually given in kilograms per cubic meter (kg/m³). To use these values together, we must convert the dimensions from millimeters to meters.

Conversion: 1 meter = 1000 millimeters

Therefore, to convert a dimension from mm to m, you divide by 1000.

Let's define the variables:

  • L: Length of the flat iron bar
  • W: Width of the flat iron bar
  • T: Thickness of the flat iron bar
  • ρ (rho): Density of the material

The formula using standard units (meters for dimensions, kg/m³ for density) becomes:

Volume (m³) = (L (mm) / 1000) × (W (mm) / 1000) × (T (mm) / 1000)

Which simplifies to:

Volume (m³) = (L × W × T) / 1,000,000,000

Or, more commonly represented as:

Volume (m³) = (L × W × T) / 109

Once the volume is calculated in cubic meters (m³), we multiply it by the material's density (ρ) to find the weight in kilograms (kg):

Weight (kg) = Volume (m³) × Density (kg/m³)

Variable Explanations and Units

Variable Meaning Unit Typical Range
Length (L) The longest dimension of the flat iron bar. Millimeters (mm) 100 mm – 12000 mm (0.1m – 12m)
Width (W) The dimension perpendicular to the length and thickness. Millimeters (mm) 10 mm – 300 mm
Thickness (T) The smallest dimension of the cross-section. Millimeters (mm) 2 mm – 50 mm
Density (ρ) Mass per unit volume of the material. Kilograms per cubic meter (kg/m³) ~2700 (Titanium) to ~8960 (Stainless Steel)
Volume The space occupied by the flat iron bar. Cubic meters (m³) Varies greatly based on dimensions.
Weight The mass of the flat iron bar. Kilograms (kg) Varies greatly based on dimensions and density.

Practical Examples (Real-World Use Cases)

Example 1: Calculating Weight for a Steel Support Beam

A structural engineer needs to determine the weight of a standard steel flat bar used as a support element in a small construction project.

  • Input Dimensions:
    • Length (L): 2400 mm
    • Width (W): 100 mm
    • Thickness (T): 12 mm
  • Material: Standard Steel (Density = 7850 kg/m³)
Calculation Steps:
  1. Convert dimensions to meters: L=2.4m, W=0.1m, T=0.012m.
  2. Calculate Volume: Volume = 2.4m × 0.1m × 0.012m = 0.00288 m³.
  3. Calculate Weight: Weight = 0.00288 m³ × 7850 kg/m³ = 22.656 kg.
Result Interpretation: The steel flat bar weighs approximately 22.66 kg. This information is vital for the engineer to confirm it meets load requirements and for the procurement team to order the correct quantity. This is a good example of using the flat iron weight calculator for structural components.

Example 2: Estimating Material for a Custom Metal Frame

A metal fabricator is building a custom frame for an industrial machine and needs to estimate the total weight of the steel flat bars required.

  • Input Dimensions for one bar:
    • Length (L): 1500 mm
    • Width (W): 60 mm
    • Thickness (T): 8 mm
  • Material: Standard Steel (Density = 7850 kg/m³)
  • Quantity: 4 bars of these dimensions
Calculation Steps (for one bar):
  1. Convert dimensions to meters: L=1.5m, W=0.06m, T=0.008m.
  2. Calculate Volume: Volume = 1.5m × 0.06m × 0.008m = 0.00072 m³.
  3. Calculate Weight per bar: Weight = 0.00072 m³ × 7850 kg/m³ = 5.652 kg.
  4. Calculate Total Weight: Total Weight = 5.652 kg/bar × 4 bars = 22.608 kg.
Result Interpretation: Each flat bar weighs about 5.65 kg, and the total project requires approximately 22.61 kg of steel flat bar. This helps in accurate material costing and managing workshop inventory. This scenario highlights the practical use of a flat iron weight calculator in fabrication workshops.

How to Use This Flat Iron Weight Calculator

Using our online calculator is simple and designed for speed and accuracy. Follow these steps:

  1. Input Dimensions: Enter the exact length, width, and thickness of your flat iron bar in millimeters (mm) into the respective fields. Ensure you are measuring accurately.
  2. Select Material: Choose the type of metal your flat iron bar is made from using the dropdown menu. The calculator uses standard densities for common metals like steel, aluminum, and stainless steel.
  3. Calculate: Click the "Calculate Weight" button. The tool will instantly process your inputs.
  4. View Results: The primary result, the total weight in kilograms, will be displayed prominently. You will also see intermediate values like the calculated volume and the density used. A detailed table breaks down each input and calculation step.
  5. Interpret Results: The weight figure is crucial for material purchasing, structural analysis, and shipping logistics. Use the intermediate values for double-checking or deeper analysis.
  6. Copy or Reset: Use the "Copy Results" button to transfer the key figures to your clipboard for reports or documentation. Click "Reset" to clear the fields and start a new calculation.

This calculator provides a reliable estimate, but always consider potential variations in material batches or minor deviations from ideal dimensions in real-world applications. For critical applications, consult with material suppliers or conduct physical verification.

Key Factors That Affect Flat Iron Weight Results

While the basic formula is straightforward, several factors can influence the accuracy and interpretation of the calculated weight:

  1. Material Density Variations: Although standard densities are used, slight variations can occur between different grades of the same metal (e.g., different types of steel alloys). For highly precise applications, confirm the exact density of your specific material batch. This is why selecting the correct material type is crucial when using a flat iron weight calculator.
  2. Dimensional Accuracy: Real-world metal stock might not perfectly match the nominal dimensions. Mill tolerances can mean the actual width, thickness, or length varies slightly. Over long lengths or large quantities, these small differences can accumulate and affect the total weight.
  3. Surface Treatments and Coatings: Processes like galvanizing, plating, or painting add a layer of material to the surface. While usually a small percentage of the total weight, for very precise calculations or specific project requirements, this added mass should be considered.
  4. Holes or Cutouts: If the flat iron bar has holes drilled or sections removed (e.g., for joints or weight reduction), the actual weight will be less than calculated. The basic calculator assumes a solid, continuous bar.
  5. Temperature Effects: Metals expand and contract with temperature changes. While typically negligible for standard weight calculations, extreme temperature fluctuations could theoretically cause minor changes in dimensions and, therefore, weight.
  6. Measurement Precision: The accuracy of your input values directly impacts the output. Ensure your measurements are taken carefully using calibrated tools. Double-checking measurements is a fundamental part of accurate flat iron weight calculator usage.

Frequently Asked Questions (FAQ)

Q1: What is the standard density of steel used in this calculator?

The calculator uses a standard density of 7850 kg/m³ for typical carbon steel. This is a widely accepted average value for most common steel applications.

Q2: Can I calculate the weight of other shapes like round bars or tubes?

This specific calculator is designed for flat iron (rectangular bars) only. Different shapes require different volume calculation formulas.

Q3: What units should I use for the dimensions?

Please enter all dimensions (Length, Width, Thickness) in millimeters (mm). The calculator will handle the necessary conversions to meters for the internal calculations.

Q4: Does the calculator account for imperial units (inches, pounds)?

Currently, the calculator accepts dimensions in millimeters (mm) and outputs weight in kilograms (kg). For imperial conversions, you would need to convert your inch measurements to millimeters before inputting them, or manually convert the final kilogram result to pounds (1 kg ≈ 2.20462 lbs).

Q5: What if my material density is different from the options provided?

If your material has a specific density not listed, you can manually calculate the weight using the formula: Weight = Volume × Density. You can calculate the volume using the dimensions provided by the calculator's intermediate results and then multiply by your specific density value.

Q6: How accurate is the calculated weight?

The calculator is highly accurate based on the provided dimensions and standard material densities. However, real-world factors like manufacturing tolerances and specific alloy compositions can cause slight variations.

Q7: What is the "Volume" result shown in liters (L)?

The volume is calculated in cubic meters (m³). The calculator then converts this to liters (L) for easier comprehension, as 1 m³ = 1000 L. This provides an alternative perspective on the material's volume.

Q8: Can I calculate the weight of multiple flat bars at once?

This calculator calculates the weight for a single piece of flat iron based on the dimensions you enter. To calculate for multiple pieces, either multiply the final result by the number of identical pieces or perform separate calculations for bars with different dimensions.

Related Tools and Internal Resources

var lengthInput = document.getElementById('length'); var widthInput = document.getElementById('width'); var thicknessInput = document.getElementById('thickness'); var materialDensitySelect = document.getElementById('materialDensity'); var lengthError = document.getElementById('lengthError'); var widthError = document.getElementById('widthError'); var thicknessError = document.getElementById('thicknessError'); var primaryResultDisplay = document.getElementById('primaryResult'); var volumeResultDisplay = document.getElementById('volumeResult'); var lengthInMetersDisplay = document.getElementById('lengthInMeters'); var densityValueDisplay = document.getElementById('densityValue'); var tableLengthCell = document.getElementById('tableLength'); var tableWidthCell = document.getElementById('tableWidth'); var tableThicknessCell = document.getElementById('tableThickness'); var tableDensityCell = document.getElementById('tableDensity'); var tableVolumeCell = document.getElementById('tableVolume'); var tableWeightCell = document.getElementById('tableWeight'); var chart = null; var chartContext = null; function getNumericValue(id) { var input = document.getElementById(id); var value = parseFloat(input.value); return isNaN(value) ? null : value; } function getSelectedText(id) { var select = document.getElementById(id); return select.options[select.selectedIndex].text; } function validateInput(inputId, errorId, minValue = 0, maxValue = Infinity) { var input = document.getElementById(inputId); var errorDisplay = document.getElementById(errorId); var value = getNumericValue(inputId); if (input.value.trim() === ") { errorDisplay.textContent = 'This field is required.'; input.style.borderColor = 'var(–error-color)'; return false; } else if (value === null) { errorDisplay.textContent = 'Please enter a valid number.'; input.style.borderColor = 'var(–error-color)'; return false; } else if (value maxValue) { errorDisplay.textContent = 'Value cannot exceed ' + maxValue + '.'; input.style.borderColor = 'var(–error-color)'; return false; } else { errorDisplay.textContent = "; input.style.borderColor = 'var(–input-border-color)'; return true; } } function updateChart(weight, volume) { if (!chartContext) { chartContext = document.getElementById('weightChart').getContext('2d'); chart = new Chart(chartContext, { type: 'bar', data: { labels: ['Weight (kg)', 'Volume (m³)'], datasets: [{ label: 'Calculated Values', data: [weight, volume], backgroundColor: [ 'rgba(0, 74, 153, 0.6)', 'rgba(108, 117, 125, 0.6)' ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(108, 117, 125, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, grid: { color: 'rgba(200, 200, 200, 0.2)' } } }, plugins: { legend: { display: false }, title: { display: true, text: 'Weight vs. Volume Comparison', color: 'var(–primary-color)', font: { size: 16 } } } } }); } else { chart.data.datasets[0].data = [weight, volume]; chart.update(); } } function calculateWeight() { var isValid = true; isValid = validateInput('length', 'lengthError', 1) && isValid; isValid = validateInput('width', 'widthError', 1) && isValid; isValid = validateInput('thickness', 'thicknessError', 1) && isValid; if (!isValid) { primaryResultDisplay.textContent = '–.– kg'; volumeResultDisplay.innerHTML = 'Volume–.– L'; lengthInMetersDisplay.innerHTML = 'Length–.– m'; densityValueDisplay.innerHTML = 'Density— kg/m³'; tableLengthCell.textContent = '–'; tableWidthCell.textContent = '–'; tableThicknessCell.textContent = '–'; tableDensityCell.textContent = '–'; tableVolumeCell.textContent = '–'; tableWeightCell.textContent = '–'; updateChart(0, 0); return; } var lengthMM = getNumericValue('length'); var widthMM = getNumericValue('width'); var thicknessMM = getNumericValue('thickness'); var densityValue = parseFloat(materialDensitySelect.value); var materialName = getSelectedText('materialDensity'); var lengthM = lengthMM / 1000; var volumeM3 = (lengthMM * widthMM * thicknessMM) / 1e9; // Convert mm^3 to m^3 var weightKG = volumeM3 * densityValue; // Format results var formattedWeight = weightKG.toFixed(2); var formattedVolume = volumeM3.toFixed(5); // More precision for volume var formattedLengthM = lengthM.toFixed(3); var formattedDensity = densityValue.toString(); primaryResultDisplay.textContent = formattedWeight + ' kg'; volumeResultDisplay.innerHTML = 'Volume' + (volumeM3 * 1000).toFixed(3) + ' L'; // Convert m^3 to Liters lengthInMetersDisplay.innerHTML = 'Length' + formattedLengthM + ' m'; densityValueDisplay.innerHTML = 'Density' + formattedDensity + ' kg/m³'; tableLengthCell.textContent = lengthMM; tableWidthCell.textContent = widthMM; tableThicknessCell.textContent = thicknessMM; tableDensityCell.textContent = formattedDensity + ' (' + materialName + ')'; tableVolumeCell.textContent = formattedVolume + ' m³'; tableWeightCell.textContent = formattedWeight + ' kg'; updateChart(weightKG, volumeM3); } function resetCalculator() { lengthInput.value = '1200'; widthInput.value = '50'; thicknessInput.value = '10'; materialDensitySelect.value = '7850'; lengthError.textContent = "; widthError.textContent = "; thicknessError.textContent = "; lengthInput.style.borderColor = 'var(–input-border-color)'; widthInput.style.borderColor = 'var(–input-border-color)'; thicknessInput.style.borderColor = 'var(–input-border-color)'; calculateWeight(); // Recalculate with default values } function copyResults() { var resultText = "Flat Iron Weight Calculation:\n\n"; resultText += "Primary Result: " + primaryResultDisplay.textContent + "\n"; resultText += "Volume: " + (parseFloat(volumeResultDisplay.textContent.split('\n')[1].replace(' L', "))).toFixed(3) + " L (" + (parseFloat(tableVolumeCell.textContent.replace(' m³', "))).toFixed(5) + " m³)\n"; resultText += "Length: " + lengthInMetersDisplay.textContent.split('\n')[1] + "\n"; resultText += "Material Density: " + densityValueDisplay.textContent.split('\n')[1] + "\n\n"; resultText += "— Detailed Breakdown —\n"; resultText += "Length: " + tableLengthCell.textContent + " mm\n"; resultText += "Width: " + tableWidthCell.textContent + " mm\n"; resultText += "Thickness: " + tableThicknessCell.textContent + " mm\n"; resultText += "Material: " + tableDensityCell.textContent + "\n"; resultText += "Calculated Volume: " + tableVolumeCell.textContent + "\n"; resultText += "Calculated Weight: " + tableWeightCell.textContent + "\n"; var textArea = document.createElement("textarea"); textArea.value = resultText; document.body.appendChild(textArea); textArea.select(); try { document.execCommand('copy'); alert('Results copied to clipboard!'); } catch (err) { alert('Failed to copy results. Please copy manually.'); } document.body.removeChild(textArea); } // Initialize calculation on page load with default values document.addEventListener('DOMContentLoaded', function() { // Check if chart canvas exists before initializing if (document.getElementById('weightChart')) { chartContext = document.getElementById('weightChart').getContext('2d'); // Initialize with placeholder data or call calculateWeight() directly calculateWeight(); } else { console.error("Canvas element with id 'weightChart' not found."); } // Add event listeners for real-time updates lengthInput.addEventListener('input', calculateWeight); widthInput.addEventListener('input', calculateWeight); thicknessInput.addEventListener('input', calculateWeight); materialDensitySelect.addEventListener('change', calculateWeight); // FAQ functionality var faqHeaders = document.querySelectorAll('.faq-section h3'); faqHeaders.forEach(function(header) { header.addEventListener('click', function() { var answer = this.nextElementSibling; this.classList.toggle('active'); if (answer.style.display === 'block') { answer.style.display = 'none'; } else { answer.style.display = 'block'; } }); }); });

Leave a Comment