Seeking to implement a tab section where clicking on a tab reveals content below. I have utilized the code provided in the following CodePen, but encountering an error.
`
Uncaught TypeError: Cannot read properties of undefined (reading 'style')
`
Puzzled by the issue with the logic and why the 'style' property is inaccessible resulting in an error when clicking on a tab.
CodePen Link: https://codepen.io/theSpaceWeasel/pen/XWBKdbP?editors=1111
`
var btns = document.querySelectorAll(".tablinks");
console.log(btns);
var content = document.querySelectorAll(".tabcontent");
console.log(content);
for(var i=0; i<btns.length;i++){
btns[i].addEventListener('click', function(){
content[i].style.display = "block";
})
}
`