Solution to element hiding after jquery toggle is bound to the page Element

Source: Internet
Author: User

It has been more than a month of practice today, and the company has assigned me very few tasks. Ah, it feels a bit uncomfortable. In this case, I still have something to do. To put it bluntly, when I was writing my graduation project today, a miracle occurred after I bound jquery's toggle method to an element. All the elements bound to this method were hidden. At the beginning, I did not expect that there was a problem here. I found it only for a long time because I bound the toggle method. But why is the element hidden after binding this method?

In fact, I don't know the specific reason. I found out by searching for information that jquery's functions have changed since version 1.9, and multiple events are not supported in turn, after half a day, it turned out to be a version issue. Therefore, there are two solutions:

1. Change the jquery version at a low point.
2. If you do not want to change to a lower version of jquery, You can implement it through counters. Defines a global variable in js to record the number of clicks on the element you want to bind to the click event to achieve the same effect.

Ah, you have encountered such a problem ......

Related Article

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.