taken the stuff from http://stackoverflow.com/questions/391314/jquery-insertat and ran with it. Augmented unit tests and is more robust compared to the code referenced in the StackOverflow article.