You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
52 lines
1.9 KiB
6 months ago
|
<script>
|
||
|
document.getElementById('surveyForm').addEventListener('submit', function(event) {
|
||
|
event.preventDefault();
|
||
|
|
||
|
// Collect form data
|
||
|
const formData = new FormData(event.target);
|
||
|
const tips = [];
|
||
|
|
||
|
// Analyze responses and provide tips
|
||
|
if (formData.get('dailyWaterUsage') === 'More than 200 liters') {
|
||
|
tips.push('Consider monitoring your water usage to identify areas of excess consumption.');
|
||
|
}
|
||
|
|
||
|
// Analyze responses and provide tips
|
||
|
if (formData.get('dailyWaterUsage') === 'Less than 50 liters') {
|
||
|
tips.push('You are using less water why bro.');
|
||
|
}
|
||
|
if (formData.get('householdWater') === 'No') {
|
||
|
tips.push('Start tracking your household water usage with a meter or app.');
|
||
|
}
|
||
|
if (formData.get('drippingTap') === 'More than 20 liters') {
|
||
|
tips.push('Fix dripping taps promptly to save water.');
|
||
|
}
|
||
|
if (formData.get('tapWhileBrushing') === 'Never') {
|
||
|
tips.push('Turn off the tap while brushing to save up to 10 liters of water per day.');
|
||
|
}
|
||
|
if (formData.get('fixLeaks') === 'No') {
|
||
|
tips.push('Regularly inspect and fix leaks to prevent water wastage.');
|
||
|
}
|
||
|
if (formData.get('reuseWater') === 'Never') {
|
||
|
tips.push('Reuse greywater from washing vegetables or clothes for gardening.');
|
||
|
}
|
||
|
if (formData.get('waterAppliances') === 'None') {
|
||
|
tips.push('Invest in water-efficient appliances like low-flow faucets and dual-flush toilets.');
|
||
|
}
|
||
|
|
||
|
// Display tips
|
||
|
const tipsContent = document.getElementById('tipsContent');
|
||
|
const tipsDiv = document.getElementById('tips');
|
||
|
|
||
|
if (tips.length > 0) {
|
||
|
tipsContent.innerHTML = tips.map(tip => `<li>${tip}</li>`).join('');
|
||
|
tipsDiv.style.display = 'block';
|
||
|
} else {
|
||
|
tipsContent.innerHTML = '<p>Thank you for your responses! You are already making great choices for water conservation.</p>';
|
||
|
tipsDiv.style.display = 'block';
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|