please tell me how to transfer the values through the drop-down list to another page
<select id="checkOpt" >
<option value="Win">Win</option>
<option value="Def">Def</option>
<option value="Play">Play</option>
</select>
I’m new to javascript, from value from the drop-down list I need to change the class
const classColor = document.getElementById('classColor');
const checkOpt = document.getElementById('checkOpt');
if (checkOpt.option == "Win") {
classColor.classList.add('myb-SettledBetParticipant_Won');
classColor.classList.remove('myb-SettledBetParticipant_Lost');
}
if (checkOpt.option == "Def") {
classColor.classList.add('myb-SettledBetParticipant_Lost');
classColor.classList.remove('myb-SettledBetParticipant_Won');
} else if (checkOpt.option == "Play") {
};
I tried a lot of variations, constant mistakes
Cannot read properties of null (reading ‘classList’)
I don’t fully understand the logic and make a mistake, I can’t understand where exactly
Perhaps it needs to be done through for, but I can’t find the information in detail anywhere
<div id="classColor" class="myb-SettledBetParticipant myb-SettledBetParticipant_Lost ">
located on another page
2
Answers
selected value from the drop-down list to another page, you can use a form element with a hidden input field that holds the selected value. Then, when the form is submitted, you can access the value on the other page using the request object.
On the first page:
On the second page, you can access the value of checkOpt and classColor using the request object. For example, in PHP: