Adding Links Through JQuery

τэкnoкraτ

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 dervaze.com 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 !