Can someone assist me with comparing HTML values to check for equality?
I am looking to compare the values of two select elements in HTML and needing guidance on how to accomplish this.
Specifically, I want to determine if the selected values from both select elements are equal.
if ($("form select[name='cars']").val() == $("form select[name='colour']").val()) {
#perform tasks
}
<form method="post">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select name="colour">
<option value="black">black</option>
<option value="yellow">yellow</option>
<option value="red">red</option>
<option value="white">white</option>
</select>
</form>