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

284
Views
How to search through an object and return a value that can be appended to HTML?

I'm trying to make an art quote calculator and am having trouble with the following code. I want the calculateQuote function to traverse through the costs object using the value of different select elements in order to find the right price and then display that price. However, I'm running into an error somewhere in the submit.onclick portion I believe. When I run the code, at that step, nothing gets populated onto the page.

const costs = {
        "painting": {
            "simple": {
                "_10x10": "25", 
                "_11x14": "55", 
                "_16x20": "75", 
                "_18x24": "100"},
            "complex": {
                "_10x10": "55", 
                "_11x14": "75", 
                "_16x20": "100", 
                "_18x24": "150-250"}
        },
    
        "pencil": {
            "simple": {
                "_11x14": "150"},
            "complex": {
                "_11x14": "150"}
        },
    
        "mural": {
            "simple": {
                "_3x5": "200-300", 
                "_8x12": "750", 
                "_10x12": "950", 
                "_8x24": "1,500"},
            "complex": {
                "_3x5": "500", 
                "_8x12": "1,150", 
                "_10x12": "1,400", 
                "_8x24": "2,300"}
        }
    }
    
    
        function calculateQuote(){
          if(typeElement.value === "painting"){
            const finalquote = costs.typeValue.complexityValue.paintingSizeValue;
          } else if(typeElement.value === "pencil"){
            const finalquote = costs.typeValue.complexityValue.pencilSizeValue;
          } else {
            const finalquote = costs.typeValue.complexityValue.muralSizeValue;
          }
          return finalquote;
        }
    
        submit.onclick = function(){
          hideDiv(complexityElement);
          hideDiv(complexityLabelElement);
          hideDiv(submit);
          let clientQuote = document.createElement('p');
          clientQuote.innerHTML = calculateQuote();
          quoteDiv.appendChild(clientQuote);
          quoteDiv.style.display = "block";
        }
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!