Jelajahi Sumber

Error messages are now replaced and not appended

Error messages are now replaced and not appended in the #errormessage div, without removing the glyphicon (which a .text() would have done).
This way, we don't have HTML code in the JS (which would be ugly). But it's still not a really elegant solution.
Hexalyse 11 tahun lalu
induk
melakukan
9687144c92
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      js/zerobin.js

+ 3 - 1
js/zerobin.js

@@ -535,7 +535,9 @@ function showError(message) {
     if ($('#status').length) {
         $('#status').addClass('errorMessage').text(message);
     } else {
-        $('#errormessage').removeClass('hidden').append(message);
+        $('#errormessage').removeClass('hidden');
+        var content = $('#errormessage').contents();
+        content[content.length - 1].nodeValue = message;
     }
     $('#replystatus').addClass('errorMessage').text(message);
 }