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

90
Views
How to prevent specific child element to be affected by href

I want when clicked on the child facebook do something else instead of href to the a tag, I want to do it with javascript also, It was not about to have them outside of it, I want to do it when it is still inside of it

<a href="www.google.com">
  
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>
  <p>I don't want facebook</p>
  
</a>

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

0

You can put it outside of your a tag then you can always put a separate a tag in each of the element where you want them to link. Let me know if this is what you mean.

<h1><a href="www.facebook.com">When you click, facebook will open</a></h1>
  <h1><a href="www.facebook.com">When you click, facebook will open</a></h1>
  <h1><a href="www.facebook.com">When you click, facebook will open</a></h1>
  

  <p>I don't want facebook</p>

about 4 years ago · Juan Pablo Isaza Report

0

Something like this?

<a href="www.google.com">
  
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>
</a>
<p>I don't want facebook</p>
  

about 4 years ago · Juan Pablo Isaza Report

0

Not sure what you're intent overall is, but you could just move the child outside of the first <a> tag and give it its own tag and link instead.

<a href="www.google.com">
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>
  <h1>When you click, facebook will open</h1>  
</a>

<a href="www.bing.com">
  <h1>When you click, bing will open</h1>
</a>

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!