diff --git a/public/assets/js/functions.js b/public/assets/js/functions.js index 9f21fae..b98e5b8 100644 --- a/public/assets/js/functions.js +++ b/public/assets/js/functions.js @@ -76,6 +76,7 @@ function deleteAddress(id) { function upCase(text) { return text[0].toUpperCase() + text.substring(1); } + function sortBy(column) { // clear titles const titles = ['first', 'last', 'street', 'zip', 'city', 'phone'] @@ -88,7 +89,7 @@ function sortBy(column) { let currentTitleElement = document.getElementById(column) let currentTitle = currentTitleElement.innerHTML - let newTitle = '' + let newTitle if (currentSortOrder.innerHTML === 'asc') { currentSortOrder.innerHTML = 'desc' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇' @@ -130,3 +131,8 @@ function sortBy(column) { } } } + +document.addEventListener('DOMContentLoaded', () => { + console.log('loaded') + sortBy('last') +}) \ No newline at end of file