Home > Web Front-end > JS Tutorial > body text

Solution to hiding elements after binding jquery toggle to page elements_jquery

WBOY
Release: 2016-05-16 16:54:06
Original
1400 people have browsed it

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. . . . . .

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!