page element binding solution for element hiding after jquery toggle

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.