EDITABLE CODE:
LiveDemo:jQuery - replaceWith() Method using function
Note: The script replaces all list items with the text specified in the function.