File size: 1,847 Bytes
44d7a73 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | document.addEventListener('DOMContentLoaded', function() {
// Form validation
const form = document.querySelector('form');
if (form) {
form.addEventListener('submit', function(e) {
e.preventDefault();
// Simple validation
const requiredFields = ['firstname', 'lastname', 'email', 'position', 'files', 'privacy'];
let isValid = true;
requiredFields.forEach(field => {
const element = document.getElementById(field);
if (!element || (element.type === 'checkbox' && !element.checked) || (element.value.trim() === '')) {
isValid = false;
element.style.borderColor = '#f87171';
} else {
element.style.borderColor = '#d1d5db';
}
});
if (isValid) {
// In a real application, you would submit the form here
alert('Vielen Dank für Ihre Bewerbung! Wir werden uns in Kürze bei Ihnen melden.');
form.reset();
} else {
alert('Bitte füllen Sie alle erforderlichen Felder aus.');
}
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
}); |