hello I am testing radio buttons on my page but it doesn't work correctly else why not go into else if block? uncheck works but not when you select a radio button
JQuery Code
$("#s1").click(function () {
if ($("input[name=test]").prop("checked", false)) {
alert("Lütfen Seçin");
} else if ($("input[name=test]:checked").val() == "dunya") {
var x = parseInt($("#testt").text());
$.ajax({
url: "test.php",
data: { get_data: x },
type: "post",
success: function (e) {
alert("Tebrikler Doğru cevapladınız ve +10 puan kazandınız");
$("#testt").text(e);
},
});
} else {
alert("Yanlış Cevap Verdiniz Tekrar Kontrol Edin");
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="radio" id="a" name="test" value="dunya">
<input type="radio" id="b" name="test" value="print">
<input type="radio" id="c" name="test" value="sayi">
<input type="button" value="Kontrol Et" class="first_btn" id="s1">