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

84
Visualizações
Having trouble creating working buttons with jquery

I am having an issue with some code I'm writing for a project. My project is a trading card game collection tracker which allows someone to add or removes cards they own from their collection and keep a digital tracker on their collection.

When I populate the collection portion of my page:

visual of collection tracker

I am creating the buttons so I know that this is working:

    const populateCollection = function () {
      for (const field in cardNames) {
         $('.collection').append('<li class="collection-details">' + cardNames[field] 
     + '<button id="removeCard">Remove Card</button>' + '</li>')
      }
    }

however I cannot get this to work for my buttons:

    const removeCardActivate = function () {
      $('#removeCard').on('click', mtgEvents.onDeleteCard)
    }

I am running both of these functions in this function:

    const onSignIn = function (event) {
      event.preventDefault()
      const form = event.target
      const authData = getFormFields(form)
      authData.credentials.email.toLowerCase()

       mtgApi
        .signIn(authData)
        .then((response) => {
          collectionId = response.cardCollection
          return response
        })
        .then(appUi.onSignInSuccess)
        .then((res) => {})
        .then(appUi.populateCollection)
        .then(appUi.removeCardActivate)
        .catch(appUi.onSignInFailure)
    }

I think it may have something to do with the sync/async but I have no idea how to fix it. I have even tried changing the id to class and adding onclick="..." to the HTML button but those also did not work.

about 4 years ago · Juan Pablo Isaza
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