Rumah > Soal Jawab > teks badan
rreeee
const userinfo = () => { // Trim -- remove spaces username = document.getElementById("username").value.trim(); email = document.getElementById("email").value.trim(); password = document.getElementById("password").value.trim(); confirmpassword = document.getElementById("confirmpassword").value.trim(); console.log(username, email, password, confirmpassword); };
Saya mahu syarat ini digunakan untuk mengisi input borang pengesahan, saya rasa mustahil untuk menyelesaikan masalah, tolong bantu saya!
P粉7382485222023-09-12 16:01:27
const checkinput = () => { if ( username.trim().length !== 0 || email.trim().length !== 0 || password.trim().length !== 0 || confirmpassword.trim().length !== 0 ) { return true; } else { msgPassword.style.border = "2px solid red"; msgConfirm.style.border = "2px solid red"; document.getElementById("error-allength").innerHTML = "请填写所有字段"; return false; } };