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

160
Views
Find elements with a specific tag/attribute pattern

In the pages there may happen clickable telephones:

<a href="tel:375292995978">๐Ÿ“ž: +375 (29) 339-59-78</a>
<a href="tel:๐Ÿ“ž: +375 (29) 339-59-78">

I'd like to assign an event listener to all telephones. The only clearly recogizable pattern here is a href="tel.

Anything else may change: the number, the icon etc.

How can I find all these elements using JavaScript?

about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

using querySelectorAll:

console.log(document.querySelectorAll("a[href^=tel]"));
<a href="tel:375292995978">๐Ÿ“ž: +375 (29) 339-59-78</a>
<a href="tel:๐Ÿ“ž: +375 (29) 339-59-78">

REFERENCE (ref: matt123miller comment)

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!