diff --git a/common/static/js/capa/chemical_equation_preview.js b/common/static/js/capa/chemical_equation_preview.js
index 85a1c2ac67..d23d8e51d3 100644
--- a/common/static/js/capa/chemical_equation_preview.js
+++ b/common/static/js/capa/chemical_equation_preview.js
@@ -3,9 +3,16 @@
function create_handler(saved_div) {
return (function(response) {
if (response.error) {
- saved_div.html("" + response.error + '');
+ edx.HtmlUtils.setHtml(
+ saved_div,
+ edx.HtmlUtils.joinHtml(
+ edx.HtmlUtils.HTML(""),
+ response.error,
+ edx.HtmlUtils.HTML('')
+ )
+ );
} else {
- saved_div.html(response.preview);
+ saved_div.html(edx.HtmlUtils.HTML(response.preview).toString());
}
});
}