EDITABLE CODE:
LiveDemo:jQuery - before() and after() Method using function
Note: Contents are added before and after using a Function as an argument