Thursday 11 June 2009

javascript string to int

problem: javascript is strange at the best of times, but i just couldnt figure out why i was getting an error

what im not doing: dwelling on it... javascript is as good as broken in some of its strange ways...


kept getting errors in simple math comparison... it occurred to me that one input was being treated as a string! so,

(parseInt(document.getElementById('whatever').value)<parseint(some_string_as_it_turns_out)))

and all was good again.