From d127d5e2246962119bb8f677ce4e8a0522906d92 Mon Sep 17 00:00:00 2001 From: Ashwin Madavan Date: Mon, 11 Oct 2021 00:32:30 -0700 Subject: [PATCH] Do not fail if generatePDF is not defined --- assets/js/script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/js/script.js b/assets/js/script.js index b53232d..314aa4b 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -130,8 +130,9 @@ // Download page to pdf format window.onload = function() { - document.getElementById("generatePDF") - .addEventListener("click", () => { + var generatePDF = document.getElementById('generatePDF'); + if (typeof(generatePDF) != 'undefined' && generatePDF != null) { + generatePDF.addEventListener("click", () => { const content = this.document.getElementById("content"); console.log(content); console.log(window); @@ -146,4 +147,4 @@ }) } -})(jQuery); \ No newline at end of file +})(jQuery);