Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
Is it possible to send event value to child function

I am building a confirming pop-up.

function addingCoin() {
const table = document.querySelector('.list__table');
const addCancelBtn = document.getElementById('list__popup__cancel');
const addConfirmBtn = document.getElementById('list__popup__confirm');
const addChecker = document.querySelector('.list__popup');

table.addEventListener('submit', (event) => {
    event.preventDefault();
    addChecker.classList.toggle('hidden');

    addCancelBtn.addEventListener('click', () => {
        addChecker.classList.toggle('hidden');
    });
    addConfirmBtn.addEventListener('click', () => {
        addChecker.classList.toggle('hidden');
        const coinAmount = event.target.inputAmount;
    };

I want to send the event to child function to make the variable "coinAmount" work properly. Is there any option to do this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, you should be able to do it this way by creating a new function

const header = document.querySelector("#__next > div > header");
const headline = document.querySelector("#__next > div > main > main > div > header > h3");

header.addEventListener("click", (event) => {
    headline.addEventListener("click", () => {
        handleClick(event);
    });
})

function handleClick (theEvent) {
    console.log(theEvent);
    // Log for the event => PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}
}

Hope that this helps you.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda