Element binding in jquery after the toggle, the element is hidden, at the beginning I did not think that there is a problem, I looked for a long time to find that is because the binding of the toggle method
To today's internship has been one months, the company assigned me a few tasks, hey, feel a little uncomfortable ah. In this way, I still have things to do, to write graduation design. To get to the point, when I was writing my graduation project today, a miracle occurred after the toggle method of binding jquery to an element, and all the elements of the binding method were hidden. At the beginning I did not think that there is a problem, I looked for a long time to find that is because the binding of the toggle method. But why is the element hidden after this method is bound?
In fact, I do not know the specific reasons, I found that the original jquery in version 1.9 after the function has changed, not to support a number of events turn switch, and engaged in a half-day version of the problem. As a result, there are two solutions, and the two approaches are now thought of:
1, change a slightly lower jquery version
2, if you do not want to change the lower version of jquery, it can be achieved through the counter. The meaning is to define a global variable in JS to record the number of times that the element you want to bind the event to is clicked, so as to achieve the same effect.
Ah, incredibly encountered such a problem, a moment of silence ...