Adding Links Through JQuery


I prefer JQuery way of append() than plain JavaScript inner HTML method of adding elements to a page. This way it is easier to identify errors and produce nice DOM trees without dealing with markup.

In I added a page for each element in the dictionary. These pages should be reachable from the main page, so I decided to add links from word results to the word pages.

I just added

{.sourceCode .js} .append($('<a>') .attr("href", link)

to the appropriate place in the tree and it put the link.

Comments !