What your code does is compare two DOM references together. This will always give false as you are comparing different HTML elements. What you mean to do is to compare the elements’ values. Your code should be like this:
$( document ).ready(function() {
var d1 = document.getElementById("edit-submitted-23");
var d2 = document.getElementById("edit-submitted-24");
if (d1.value == d2.value)
{
alert("You have choosen the same value");
}
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="edit-submitted-23">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<select id="edit-submitted-24">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
I should also note that your code defines a function validate() but doesn’t use it. You don’t need to define it. Or if you do, you need to call it afterwards:
$(document).ready(function(){
function validate(){
....
}
validate();
})