I have this javascript code:
var right = document.getElementById("true").checked;
var wrong = document.getElementById("false").checked;
if (right){
answer += 100;
}
I want to replace the Javascript with jQuery, so I replaced this line:
var right = document.getElementById("true").checked;
with this:
var right = $('#true')[0].attr('checked');
I have also downloaded and added the jQuery file to my HTML:
<script src="jquery-1.11.2"></script>
However when I replaced the above JS code with jQuery it isn't working at all. What am I doing wrong ?
EDIT: I have also tried this,
function calc(){
$(function() {
var isTrue = $('#true').attr('checked');
});
var wrong = document.getElementById("false").checked;
if (right){
answer += 100;
}
}
But it is still not working.