Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

78
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!