Changed js code to address issue #1

Issue #1 has ben addressed, only showing error message when no previous messages have been shown.