// Custom JavaScript for MyMech document.addEventListener('DOMContentLoaded', function () { // Registration form logic const registrationForm = document.getElementById('registrationForm'); if (registrationForm) { const userRole = document.getElementById('user_role'); const garageNameField = document.getElementById('garage_name_field'); const garageNameInput = document.getElementById('garage_name'); function toggleGarageNameField() { const selectedRole = userRole.value; if (selectedRole === 'mechanic' || selectedRole === 'shop_owner') { garageNameField.style.display = 'block'; garageNameInput.required = true; } else { garageNameField.style.display = 'none'; garageNameInput.required = false; } } // Initial check toggleGarageNameField(); // Listen for changes userRole.addEventListener('change', toggleGarageNameField); } console.log("MyMech JS loaded"); });