TestingFrenzy

player.js

May 28th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. /**
  2. * Event listener for the DOMContentLoaded event.
  3. * This function sets up click event listeners for the career data and last season stats buttons.
  4. *
  5. * @function
  6. */
  7. document.addEventListener('DOMContentLoaded', function() {
  8. /**
  9. * Event listener for the 'click' event on the 'btnCareerData' button.
  10. * This function shows the career data section and hides the last season data section.
  11. *
  12. * @function
  13. */
  14. document.getElementById('btnCareerData').addEventListener('click', function() {
  15. // Show career data and hide last season data
  16. document.getElementById('careerData').classList.remove('d-none');
  17. document.getElementById('lastSeasonData').classList.add('d-none');
  18.  
  19. // Highlight the active button
  20. this.classList.add('active');
  21. document.getElementById('btnLastSeasonStats').classList.remove('active');
  22. });
  23.  
  24. /**
  25. * Event listener for the 'click' event on the 'btnLastSeasonStats' button.
  26. * This function shows the last season data section and hides the career data section.
  27. *
  28. * @function
  29. */
  30. document.getElementById('btnLastSeasonStats').addEventListener('click', function() {
  31. // Show last season data and hide career data
  32. document.getElementById('lastSeasonData').classList.remove('d-none');
  33. document.getElementById('careerData').classList.add('d-none');
  34.  
  35. // Highlight the active button
  36. this.classList.add('active');
  37. document.getElementById('btnCareerData').classList.remove('active');
  38. });
  39. });
  40.  
  41.  
Tags: js
Advertisement
Add Comment
Please, Sign In to add comment