diff --git a/common/lib/capa/capa/templates/chemicalequationinput.html b/common/lib/capa/capa/templates/chemicalequationinput.html
index f705ec3d06..becd2a330a 100644
--- a/common/lib/capa/capa/templates/chemicalequationinput.html
+++ b/common/lib/capa/capa/templates/chemicalequationinput.html
@@ -29,10 +29,8 @@
% endif
-
-
+
-
diff --git a/common/static/js/capa/chemical_equation_preview.js b/common/static/js/capa/chemical_equation_preview.js
index f271aaf8df..90ce27ad11 100644
--- a/common/static/js/capa/chemical_equation_preview.js
+++ b/common/static/js/capa/chemical_equation_preview.js
@@ -1,7 +1,5 @@
(function () {
update = function() {
- preview_div = $(this).siblings('div.equation');
-
function create_handler(saved_div) {
return (function(response) {
if (response.error) {
@@ -12,6 +10,9 @@
});
}
+ prev_id = "#" + this.id + "_preview";
+ preview_div = $(prev_id)
+
$.get("/preview/chemcalc/", {"formula" : this.value}, create_handler(preview_div));
}