I need help about jQuery.
How I can I make the font color of the 74 into red.
I mean once grade is below 75 font color will change to red or else green if passed.
$("document").ready( function(){
//alert("working");
var passing_grade = parseInt("75");
var grade = parseInt($(".grade").val());
if( grade < passing_grade ){
$(".grade").css("color","#ff000");
} else {
$(".grade").css("color","#066d06");
}
} );
valmethod is used for getting/setting values of form elements, if the.gradeelement is not a form element, you should usetextorhtmlmethod, also note whenparseIntis used, you should specify theradix.For
lielements you should usetextmethod instead ofval:http://jsfiddle.net/wsBBH/