LorenzoVald / Finals-lab

0 stars 0 forks source link

Finals lab #1

Closed LorenzoVald closed 10 hours ago

LorenzoVald commented 12 hours ago

document.getElementById("contactForm").addEventListener("submit", function(event) { const name = document.getElementById("name").value; const email = document.getElementById("email").value; const password = document.getElementById("password").value;

if (name === "" || email === "" || password === "" ) {
    event.preventDefault();
    alert("Please fill in all fields.");
}

});

document.getElementById("showPassword").addEventListener("change", function() { const passwordField = document.getElementById("password");

if (this.checked) {
    passwordField.type = "text";  
} else {
    passwordField.type = "password";  
}

});

document.getElementById('search-bar').addEventListener('input', function() { let searchQuery = this.value.toLowerCase(); let profiles = document.querySelectorAll('.profile'); let found = false;

profiles.forEach(profile => {
    let name = profile.getAttribute('data-name').toLowerCase();

    if (name.includes(searchQuery)) {

        profile.scrollIntoView({ behavior: 'smooth' });
        found = true;

        return; 
    }
});

if (!found && searchQuery !== "") {

    console.log("No matching profiles found.");
}

});

received_1064829461639091 received_1247017803205353 received_552119047510877 received_1893859897767285 received_1114649946674304

LorenzoVald commented 10 hours ago

logout.php.txt