Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Javascript: Strange type conversion

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Jun 20, 2020 at 9:12 history edited Community Bot
Commonmark migration
Apr 8, 2015 at 22:09 comment added Walt Wonderwolk @JanLegner That did it! Smart guy you are. TA
Apr 8, 2015 at 22:03 comment added Jan Legner zoom = $(this).val(); saves a string, you need to convert it to a proper type of number - for sure it would be better to save it as a number at first place (when onchange is triggered), so you do not have to convert it over and over agian. For further info see my answer.
Apr 8, 2015 at 21:59 answer added Jan Legner timeline score: 2
Apr 8, 2015 at 21:59 comment added Walt Wonderwolk I have tried using zoom = parseInt($(this).val(), 10); but strangely enough it loses the value i.e perhaps convert it to undefined or null.
Apr 8, 2015 at 21:56 comment added elclanrs Seems like this line is where the problem starts zoom = $(this).val();. You should make sure it is a number at that point.
Apr 8, 2015 at 21:53 history asked Walt Wonderwolk CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /