javascript - jQuery keyup working incorrectly -
I am trying to increase an integer variable every time the Enter key is pressed, this variable then returns the value from an array is used to.
$ (document) .keyup (function (e) {if (e.keyCode == 13) {console.log (+ ($) ($ "'), $ (' # ('Background', "# 4b84e5")} and if (outside [currSteps]. (Outrage [currsteps]% 2 == 0) {$ ('body'). ] == 1) {$ ('body'). CSS ("background", "# 9d622"}} and {$ ('body'). CSS ("background", "# d16323")}}}) ;
The problem occurs when I actually press Enter on the first press, it works properly, and increases the variable currSteps
and the next in the array Displays the value. However, when I After pressing Enter, it returns it back to the original value of currStep
, as long as the entry is placed below, it will display the default value
Now, yes , This event is for funnel
, so it is understood that things will work oddly on the keydown
however ... if I open the developer tools and the console I click around, and then return to my original window, then the code is completely keyup
In the after developer opened the device itself has been doing this work?
I have tried to do it on jQuery 1.11.1 and 1.10.2.
Edit: currSteps
and outgoing
announcements.
$ ('#'). Click (function () {$ ('# output'). Empty (); $ ('#steps') empty (); var step = 0 currSteps = 0 var inNum = parseInt ($ ('# input'). Val [] " $ (document) .ready (function () {var currSteps = 0; var outNum = {0: 0, 1: 1, 2: 2}; $ (document) key (function (e) {if (e.keyCode == 13) {console.log (++ currSteps); $ ('# output'). ($ [CurrSteps] + "+ currSteps" if (outrun [CurrSteps]% 2 == 0) {$ ('BO CSS' ("background", "# 9D622")} and {$ ("background", " # 4 9 84 "5)} And if (outm [currSteps] == 1) {$ ('body'). ('Body'). CSS ("background", "# d16323")}}})}};
Do you still have a real problem with the upper demo?
Comments
Post a Comment