I have checked your code,
can you check with alert above if condition :
"alert("txtGMarksObtain" + txtGMarksObtain + " and " + "txtGMaxMarks" + txtGMaxMarks);"
you got the value or not, i think code is working fine but just check in console you got the any error.