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

82
Visualizações
Xpath not working to Match a Text using and retrieve the related Parent Div object to change the style in IE11

I have a requirement to change the parent Div's text color based on it's one of the child div's text, I have implemented following method to get the parent Div element using xpath(please note that I'm still on the way to change the style, Just abled to access the immediate Div object ). the code is working fine in chrome and EDGE .but it doesn't work for IE11. Can some one help me to implement a different approach for this which will work for all three browsers.

---------------- HTML structure-----------------------

<div class="table" id="finalResults" >
<div class="table_row" >
<div class="cell_wrapper">
<div class="cell"  >City</div> <div class="cell" >Destination city not found</div>
</div>
</div>
</div
```


```

---------------- javascript code-----------------------


            var xpath = "//div[starts-with(text(), 'Destination city not found')]";
            
            var matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
            document.getElementById("demo").innerHTML = matchingElement.innerHTML;
        })
``` 
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