Javascript/Jquery

JQuery - difference between append() and prepend()

Posted by amit on April 12, 2010 at 9:49 pm

append() and prepend() methods: similar to appendChild, except jQuery accepts a string, a DOM element, or a jQuery object as valid arguments. jQuery converts the argument into a text node or element depending on what is passed.

$(”#leftNav ul”).append(”<li>after the last &lt;li&gt;</li>”); // adds <li> at the end of <ul>
$(”#leftNav ul”).prepend(”<li>before the first &lt;li&gt;</li>”); [...]

Linked List class in Javascript

Posted by amit on March 18, 2009 at 4:44 am

ThisĀ  is an exercise in using the object oriented concepts in Javascript to implement a doubly linked list.
There is a class called Node which encapsulates the actual node in the list. The linked list is implemented as a global object with class variables and methods to:

Add a node
Remove a node
Search for a node
Sort the list [...]