I have to do a project for school where the site will do different calculations based on which radio button is checked. The site is about solar panels and calculating the price. I have no idea where to even start, so I just copied some things from some tutorials and got this:
function cena ()
{
let opcja = document.getElementsByName('opcja');
opcja.forEach((opcja) => {
if (opcja.checked) {
if opcja = document.getElementById("standard");
document.getElementById("wynik").innerHTML="A";
else
if opcja = document.getElementById("premium");
document.getElementById("wynik").innerHTML="B";
}
})
;
}
This, of course, doesn't work and I'm totally lost, so I'm asking for some help or a recommendation on a website where this is explained. The goal is for when the "standard" option is selected, the script will use a lesser value/coefficient to calculate the price.