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

151
Views
How to stop inputA from changing?

so how can i make inputA and inputB have different numbers? right now inputA is the same as inputB ‎‎‎‎‎‎‎‎‎‎‎

const numbers = document.querySelectorAll(".numbers");
numbers.forEach((number) => {
  number.addEventListener("click", () => {
    display.textContent += number.innerHTML;
    inputA = display.textContent;
    console.log(inputA + "a")
  });
});

const functions = document.querySelectorAll(".func");
functions.forEach((fnction) => {
  fnction.addEventListener("click", () => {
    display.textContent = "";
    operatorInput = fnction.innerHTML;
    console.log(operatorInput)

    
      numbers.forEach((number) => {
      number.addEventListener("click", () => {
        
        inputB = display.textContent;
        console.log(inputB + "b");
      });
    });

  })
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First of all document.querySelectorAll doesnt return array. The proper usage is:

Array.from(document.querySelectorAll(selector)).forEach... 

Please check the reference https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll

You dont declare variables inputA and inputA (let inputA, let inputB). What's more, display.textContent in case B is equal to the display.textcontent from the case A. Because it's the same element. Despite you attempt to clear textContent in the upperscope (case B) it has no effect.

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