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

98
Views
Selecting a div matching an attribute using JQuery is failing

I go to https://www.tradingview.com/chart/?symbol=BINANCE:BTCUSDTPERP and press OPT+g (ALT+g for non-mac) and a TimeRange overlay appears.

enter image description here

I'm trying to simulate clicking on the 'Custom range' tab using JavaScript from the console.

But $('#overlap-manager-root > div > [attribute="CustomRange"]') fails to retrieve it.

This is odd to me because $('#overlap-manager-root > div button') successfully picks out the 2 buttons.

I'm using https://api.jquery.com/attribute-equals-selector/ for reference.

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

0

The > combinator is for direct descendants. This means the element after the > needs to be in the parent element (the element named before >) directly and not in some child element.

For example, #overlap-manager-root > div > [data-value="CustomRange"] would match

<div id="overlap-manager-root">
   <div>
       <button data-value="CustomRange"></button>
   </div>
</div>

But would not match

<div id="overlap-manager-root">
   <div>
       <div id="someotherdiv">
          <button data-value="CustomRange"></button>
       </div>
   </div>
</div>

Removing the > will make it look for any element within the subhierarchy and not just the direct children.

So switch the selector to

#overlap-manager-root > div [data-value="CustomRange"]

and this should find your element.

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!