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

81
Views
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
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!