I need to check if the radio button input field is checked or not using Javascript/Jquery. Actually I am setting the radio button field dynamically but while checking whether this field is checked or not it's showing me the result false where it is really checked. My code is below.
<input type="radio" name="answer_type0" id="answer_type0" onClick="selectScale(this.value,'0');" value="<?php echo $v['_id']; ?>"> <?php echo $v['answertype']; ?>
My javascript code is below.
$('#answer_type0[value="' + qdata[0].answer_type + '"]').prop('checked', true).trigger('click');
console.log('check',document.getElementById('answer_type0').checked);
Here my radio input field seems checked on the UI page but while i am checking the console.log message its showing false. Here I need if the radio button field is checked it should give the message true but it's not happening like that.