Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda