diff --git a/docs/_includes/repl.html b/docs/_includes/repl.html
index 5f609262..fa9993a5 100644
--- a/docs/_includes/repl.html
+++ b/docs/_includes/repl.html
@@ -64,11 +64,7 @@
var lastError = undefined;
function output(text) {
- var output_clear = document.getElementById("output-clear");
var output_box = document.getElementById("output");
- if (output_clear.checked) {
- output_box.value = '';
- }
output_box.value += text.replace('stdin:', '') + "\n";
// scroll to bottom
output_box.scrollTop = output_box.scrollHeight;
@@ -84,6 +80,12 @@
lastError = undefined;
}
+ var output_clear = document.getElementById("output-clear");
+ if (output_clear.checked) {
+ var output_box = document.getElementById("output");
+ output_box.value = '';
+ }
+
var err = Module.ccall('executeScript', 'string', ['string'], [editor.getValue()]);
if (err) {
var err_text = err.replace('stdin:', '');