I am trying to make a tab section whenever we click on a tab, a content appears below , i have used the code in the following codepen, but i get an error
`
Uncaught TypeError: Cannot read properties of undefined (reading 'style')
`
I don't understand what is wrong with the logic or why isn't the property style not accessible and why do i get this error whenever i click 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";
})
}
`