function taint() {
   // activate buttons "apply", "revert"
   Array.from(document.getElementsByClassName("enable_on_change")).forEach((el) => {
-    el.disabled = false;
+      el.disabled = false;
   });
   // deactivate Booking links
-  Array.from(document.getElementsByClassName("disable_on_change")).forEach((span) => {
-    let links_text = '';
-    Array.from(span.childNodes).forEach((node) => {
-      links_text += node.textContent + ' ';
-    });
-    span.innerHTML = '';
-    const del = document.createElement("del");
-    span.appendChild(del);
-    del.textContent = links_text;
+  Array.from(document.getElementsByClassName("disable_on_change")).forEach((el) => {
+      if (el.tagName == 'span') {
+          let links_text = '';
+          Array.from(el.childNodes).forEach((node) => {
+            links_text += node.textContent + ' ';
+          });
+          el.innerHTML = '';
+          const del = document.createElement("del");
+          el.appendChild(del);
+          del.textContent = links_text;
+      } else if (el.type == "button") {
+          el.disabled = true;
+      }
   });
   // remove oninput handlers no longer needed (since we only ever go one way)
   ['input', 'textarea'].forEach((tag_name) => {
       Array.from(document.getElementsByTagName(tag_name)).forEach((el) => {
-        el.oninput = null;
+          el.oninput = null;
       });
   });
 }
 
   table.appendChild(tr);
   const td = add_td(tr, 5);
   add_button(td, 'add line', false, function() {
-   new_line = {error: '', comment: '', booking_line: {account: '', amount: '', currency: ''}};
-   dat_lines.push(new_line);
+    new_line = {error: '', comment: '', booking_line: {account: '', amount: '', currency: ''}};
+    dat_lines.push(new_line);
   });
 
   // make all rows alternate background color for better readability
 {% block content %}
 <form action="/edit_structured/{{id}}" method="POST">
 {{ macros.edit_bar("raw", id) }}
-<input type="button" onclick="replace()" value="replace string">
+<input type="button" onclick="replace()" value="replace string" class="disable_on_change">
 from
 <input id="replace_from" />
 to