I am doing a javascript coding challenge where I must get references from the nav buttons from the HTML file. its for a registration form
HTML
<!-- Conditional Nav buttons -->
<nav>
<button class="users" id="users-tab-button">Register User</button>
<button class="register" id="register-tab-button">View User List</button>
</nav>
<!-- /Conditional Nav buttons/ -->
JS
/* ----------------------------------------------------
Setup
---------------------------------------------------- */
/* --- Tab References --- */
// Get reference to all elements in register tab
const registerTab = document.getElementsByClassName("register");
console.log(registerTab);
// Get reference to all elements in userList tab
const userTabs = document.getElementsByClassName("users");
console.log(userTabs);
/* --- Nav references --- */
//get refernce to Register User button
const regUser = document.querySelector('#users-tab-button');
console.log(regUser);
//get reference to viewUserList button
const viewUserList = document.querySelector("#register-tab-button")
console.log(viewUserList);
What I am doing here is getting the IDs of the nav buttons, but now, do I need to link them to the registerTab and the userTabs? as well, as it stands the regUser and the viewUserList are showing null