I have dynamically created radio buttons and have assigned them ids. Now when i try,
function updateAO(id2) {
var status = $('input[name=id2]:checked').val();
alert(status);
}
It prints undefined. Can anyone please tell how to get this value. Thanks in advance!!
The :checked
selector will only select inputs currently checked, if the passed input isnt checked at the time, status will remain unset, try changing your JS to:
function updateAO(id2) {
var status = $('input[name='+id2+']').val();
alert(status);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments