Only clear the input field if the reply was posted.
[Sone.git] / src / main / resources / static / javascript / sone.js
index 33f45df..69c11e0 100644 (file)
@@ -449,9 +449,9 @@ function ajaxifyPost(postElement) {
                inputField = $(this.form).find(":input:enabled").get(0);
                postId = getPostId(this);
                text = $(inputField).val();
-               $(inputField).val("");
                postReply(postId, text, function(success, error, replyId) {
                        if (success) {
+                               $(inputField).val("");
                                loadNewReply(replyId);
                                markPostAsKnown(getPostElement(inputField));
                                $("#sone .post#" + postId + " .create-reply").addClass("hidden");