diff --git a/content_scripts/create_total_cards_button.js b/content_scripts/create_total_cards_button.js
index dbaeda5..5cb8224 100644
--- a/content_scripts/create_total_cards_button.js
+++ b/content_scripts/create_total_cards_button.js
@@ -6,19 +6,16 @@
// Count number of cards.
const numberOfCards = document.querySelectorAll(".list-card").length;
- // Create on/off button instance.
- const buttonInstance = document.getElementById("button-total-cards-count");
-
- // Create HTML for button.
- const numberOfCardsButtonHTML = ``;
-
- // Inner HTML of header buttons
- let boardHeaderButtons = document.getElementsByClassName(
- "board-header-btns mod-left"
- )[1].innerHTML;
-
// Check if button already exists before creating it.
- if (!buttonInstance) boardHeaderButtons += numberOfCardsButtonHTML;
-})();
+ let buttonInstance = document.getElementById("button-total-cards-count");
+ if (buttonInstance === null) {
+ // Create HTML for button.
+ let numberOfCardsButtonHTML = ''
+ // Add button to Trello board.
+ document.getElementsByClassName("board-header-btns mod-left")[1].innerHTML += numberOfCardsButtonHTML;
+ } else {
+ // Do nothing.
+ }
+})();
\ No newline at end of file