Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Java by (9.5k points)

I want to put a string for a title and a string for a link together to create a link on a page using JavaScript. Can anyone tell me how to do it?

1 Answer

0 votes
by (19.7k points)

See the below code implementation:





      var a = document.createElement('a');

      var linkText = document.createTextNode("my title text");


      a.title = "my title text";

      a.href = "";





Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

0 votes
1 answer
asked Feb 26, 2021 in Java by sheela_singh (9.5k points)
0 votes
1 answer
asked Feb 17, 2021 by Harsh (1.5k points)
0 votes
1 answer
0 votes
1 answer
asked Jan 25, 2021 in Java by dante07 (13.1k points)

Browse Categories