How to do maths in if and else in jquery? -
hello guys!
i have been trying create if/else statement code in jquery guess if/else statement resting in peace! don't know getting wrong have did , still not working correctly! ok, here problem list ~
- my
if/elsegetting inverse! - and think getting messed up!
- jslint (in jsfiddle.net) showing no error in jquery code!
please here problem demo link ~~~~~~~~~~
here smaple jquery code ~~~~~~~~~
$(function () { var correct = '10'; var incorrect = '9'; $('div.correct_incorrect').css("background",function () { if( correct > incorrect ) { return "#796"; } else if( correct == incorrect ) { return "#345"; } else { return "#732"; } }); }); please me out!
thanks in advance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sorry bother guys previous question solved i'm having new problem code. here i'm trying retrive value 2 input elements! not working.
please have here ----
thanks in advance (for 1 too!)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the problem correct , incorrect strings. can change them integers fix problem:
var correct = 10; var incorrect = 9; alternatively, can use parseint(mynumasstring, 10) convert string number @ runtime.
Comments
Post a Comment