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

232
Views
how to write/print href links with link text/title - javascript

this is my code - not complete.

how to write/print href links with link text/title. result like this http://google.com/123.asp 123 http://google.com/456.asp 456 http://google.com/789.asp 789

<y id='txt'>
<a href="http://google.com/123.asp">123</a>
<a href="http://google.com/456.asp">456</a>
<a href="http://google.com/789.asp">789</a>
</y>


<script>

    var y = document.getElementById("txt");
   var linktext = p.getElementsByTagName("textcontent");
   const links = document.links;
   var text = '';
   for (var i = 0; i < linktext.length; i++){
       text += links[i] + "<br>" + linktext[i].innerHTML + "<br>";
   }
    
   p.innerHTML = text;



</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can try this

`

<script>    
var y = document.getElementById("txt");
var links = y.getElementsByTagName('a')
var text = '<p>';
for (var i = 0; i < links.length; i++){
   text += '<a href="' + links[i].getAttribute('href') + '">' + links[i].getAttribute('href') +  '</a>'  + " " + links[i].innerText + "<br/>";
}

text+= '</p>'

y.innerHTML = text;

</script>

`

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!