내가 문제,내가 원하는 전송할 때 형성 텍스트 영역이 있 minlength20char,그러나 나의 코드 없는 작동합니다. 모든 시간 버튼을 누르면 false 를 반환합니다 내가 원하는 코드는지를 보낼 때 창을 로드하고 텍스트 영역의 길이 0
const message = document.querySelector('#message');
const btn = document.querySelector('.btn');
f = false;
t = true;
const blockBtn = (b) => {
btn.addEventListener('click', e => {
console.log(b);
e.returnValue = b;
// console.log(e.returnValue);
});
}
const textArea = function (event) {
const length = this.value.length;
console.log(length);
if (length < 20 || length == null) {
blockBtn(f);
} else {
console.log('dziala')
blockBtn(t);
};
}
const textAreaWindow = () => {
const messageValueLength = message.value.length;
if (messageValueLength == 0) {
blockBtn(f);
}
}
message.addEventListener('input', textArea);
window.addEventListener('load', textAreaWindow);