Radio button i have
For yes:
html+='<input type="radio" id="engyes'+val.id+'" name="eradios['+val.id+']" value="'+val.id+'" data-for="yes" onclick="changeinother(this.id);" class="form-control">';
For no :
<input type="radio" id="engno'+val.id+'" name="eradios['+val.id+']" value="0" data-for="no" onclick="changeinother(this.id);" class="form-control">';
On click change radio background color for yes Green and For no Red
script what i am using to change color
<script type="text/javascript">
function changeinother(radioid)
{
var curr=$('#'+radioid).attr('data-for');
if(curr=='no'){
$('input[type=radio]:checked').css('background-color','red');
}
}
</script>
I tried this but its not working with my code what i am doing wrong here can anyone please tell ??