S.O. Community, this is my first question on the website.
The error I keep getting is "testBtn.addEventListener is not a function." The code is as follows.
const testBtn = document.getElementsByClassName('test');
var brandOfCar= document.getElementsByClassName("custom-select");
testBtn.addEventListener("click",(console.log(brandOfCar.value)
));
<div class="custom-select" style="width:200px;">
<select>
<option value="0">Select car:</option>
<option value="1">Audi</option>
<option value="2">BMW</option>
<option value="3">Citroen</option>
<option value="4">Ford</option>
<option value="5">Honda</option>
<option value="6">Jaguar</option>
<option value="7">Land Rover</option>
<option value="8">Mercedes</option>
<option value="9">Mini</option>
<option value="10">Nissan</option>
<option value="11">Toyota</option>
<option value="12">Volvo</option>
</select>
<button class="test">test</button>
In the end, I need to be able to store the selected value or text of each choice into a database, whenever the button is clicked. The car brands will be in the end switched to position on the webpage for the digital newspaper(newsite).
For added, Database is setup and works well at the moment.
Thank you for reading this, and I hope the stack overflow gods have mercy on this first post.