Xavier Xavier - 9 months ago 35
Javascript Question

How do I create a link using javascript?

I have a string for a title and a string for a link. I'm not sure how to put the two together to create a link on a page using Javascript. Any help is appreciated.

EDIT1: Adding more detail to the question.
The reason I'm trying to figure this out is because I have an RSS feed and have a list of titles ands URLs. I would like to link the titles to the URL to make the page useful.

EDIT2: I am using jQuery but am completely new to it and wasn't aware it could help in this situation.


var a = document.createElement('a');
var linkText = document.createTextNode("my title text");
a.title = "my title text";
a.href = "http://example.com";