@sasha-91-95

Почему не работает form.addEventListener?

document.addEventListener('DOMContentLoaded', () =>{
    const sigInBlock = document.getElementById('sigInBlock');
    let inputEmail = (document.getElementById("inputEmail") as HTMLInputElement);
    const form = (document.getElementById('form') as HTMLFormElement);

    const userPage = document.getElementById('userPage');
    const userName = document.getElementById('userName');
    const btnEdit = document.getElementById('btnEdit');
    const btnFollow = document.getElementById('btnFollow');
    const inputLenta = document.getElementById('inputLenta');
    const myLenta = document.getElementById('myLenta');
    const btnSend = document.getElementById('btnSend');
    
    const run = () =>{
        form.addEventListener('submit', (e) =>{
            e.preventDefault();
            console.log('hi')
            console.log(inputEmail.value)
            //const response = await fetch(' http://146.185.154.90:8000/blog/' + inputEmail.value);
            
        })
    }
})
  • Вопрос задан
  • 104 просмотра
Пригласить эксперта
Ответы на вопрос 1
HardBot
@HardBot
back-end, front-end developer
document.addEventListener('DOMContentLoaded', () =>{
    const sigInBlock = document.getElementById('sigInBlock');
    let inputEmail = (document.getElementById("inputEmail") as HTMLInputElement);
    const form = (document.getElementById('form') as HTMLFormElement);

    const userPage = document.getElementById('userPage');
    const userName = document.getElementById('userName');
    const btnEdit = document.getElementById('btnEdit');
    const btnFollow = document.getElementById('btnFollow');
    const inputLenta = document.getElementById('inputLenta');
    const myLenta = document.getElementById('myLenta');
    const btnSend = document.getElementById('btnSend');
    
    const run = (() =>{
        form.addEventListener('submit', (e) =>{
            e.preventDefault();
            console.log('hi')
            console.log(inputEmail.value)
            //const response = await fetch(' http://146.185.154.90:8000/blog/' + inputEmail.value);
        })
    })();
})
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы