make a jquery plugin for doing this, pretty simple version
it should be able to add new item.
reorganized the test cases.
introduce underscore template to reduce code