I summed up some of the underlying jquery ideas, purely personal insights.
Now, to facilitate the description, the customer now gives us a need:
There are two buttons on the page, a picture that hides the image when I click the Hidden button, and displays the picture when I click the Show button. What would you do if you were to do that?
Method one: Using DOM technology to navigate to the button, when the button is clicked to trigger the JS onclick event and then throw a function, in the function using the DOM to position the picture, and then modify the visibility property of the picture.
"Improvement
Method Two: Method one can be completed, but the operation is more cumbersome. When we think of object-oriented, we can encapsulate the picture on the page and have two behaviors for the picture, namely "show" and "hidden", and when the button is clicked, the JS onclick event is triggered and a function is thrown, in which we instantiate the picture object and invoke the object's behavior (" Show "," hidden ").
"Improvement
Method Three: Method two to the method of a package, simplifying a part of the code, but we are very lazy people, or think the code is too long, writing inconvenient, then what should we do? Right!! is to encapsulate the JavaScript again, and then we just have to write the code according to our own rules. For example $ ("#ID"), its essence is a function, $ is actually just a method name, #ID是函数的形参, this gives us a false impression, is only need to call this function to be able to locate a node, in fact, it comes down to the bottom of the implementation, it still uses some of the more traditional forms, Similar to document.getElementById ();d ocument.getelementsbytagname ();d ocument. Elementsbyname ();
Some of the ideas of jquery, some of their own insights!!!!