Okay, so there are 3 ways that you can get the value of a dropdown. Bellow the code shows those ways:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<select name="cars" class="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<script>
//this just activates when you change the option in the select element
$(".cars").on("change", function() {
//the first three use jQuery, only the last one uses only DOM, pick the one you prefer
console.log($('.cars').val()); // gets the value of the first .cars class it finds
console.log($(".cars")[0].value);//gets the value of the first .cars class it finds, change the index if you want another one
console.log($($('.cars')[0]).val()); //the same as above, just change the index
console.log(document.getElementsByClassName("cars")[0].value);//the same as above, just change the index
});
</script>
</body>
</html>
If none of these ways work then the problem could be that you are using the car class on an HTML element that doesn't have the .value property so it doesn't work, therefore I suggest you make sure you check the index when selecting an element so as to make sure you select the dropdown element you want.
Another problem could be that it loads the Javascript before the HTML code, therefore I suggest you try to put the script tags not at the top of your code but at the end just before closing the body tag(see the code I put above).