It has been more than a month since my internship today, and the company has assigned me very few tasks. Alas, I feel a little uncomfortable. In this case, I still have something to do, write my graduation project. Closer to home, when I was writing my graduation project today, a miracle happened after binding jquery's toggle method to an element. All the elements bound to this method were hidden. At the beginning, I never thought there was a problem here. It took me a long time to find out that it was because the toggle method was bound. But why is the element hidden after binding this method?
Actually, I don’t know the specific reason. I found out through searching for information that jquery’s functions have changed since version 1.9. It no longer supports multiple events in turn. After working on it for a long time, it turns out that it is a version problem. . Therefore, there are two solutions, and these are the only ones that come to mind at the moment:
1. Change to a slightly lower version of jquery
2. If you don’t want to change to a lower version of jquery, you can use the counter to achieve. This means defining a global variable in js to record the number of times the element you want to bind a click event to is clicked, so as to achieve the same effect.
Hey, I encountered such a problem, so I express my condolences. . . . . .