I would like to show a modal dialog if a person select "No". And it works but I also need to keep selected answer "No".
So after I close modal window radio button not selected. Any ideas how to fix it?
here is my code:
$(function() {
$('#btnNext').attr('disabled', true);
$('input[type="radio"]').change(function(e) {
var $yes = $('input[type="radio"][value="Yes"]');
var $no = $('input[type="radio"][value="No"]');
if ($yes.filter(':checked').length === $yes.length) {
$('#btnNext').attr('disabled', false);
} else {
$('#btnNext').attr('disabled', true);
var $nope = $(this).attr("name");
var $value = $(this).attr("value");
if ($value === "No") {
$(this).attr("checked", "checked"); // $(this).attr("checked", true);
$('#' + $nope).dialog('open');
}
}
});
});