This article mainly introduces the relevant information of jQuery knowledge points. If you need it, refer to slideUp (). Slide up // you can change the attribute of the height of an element until the height is 0 to hide the element.
SlideDown ();
SlideToggle ();
FadeOut (); Fade Out // transparent
FadeIn ()
The Code is as follows:
Function (){
$ ("Span. Italian"). toggle ();
$ ("Span. Italian"). toggle ();}
Add two toggle functions to a function to implement language switching.
You can apply multiple such selectors to an element at the same time.
Put the script tag at the bottom, onlyBecause the script may cause a problem, they will block parallel downloads in the browser. Multiple images on different servers can be downloaded at the same time. Once the browser encounters a script mark, it cannot download Multiple Elements in parallel.
Put the following to improve the download speed
Var msg = "high score:"+ Pts +""
// You can add html tags to variables.
Var discount = Math. floor (Math. random () * 5) + 5); // outputs a number between 5 and 10.
// Math. random (); returns a random number ranging from 0 to 1.
// Math. floor (x); returns the largest integer smaller than x.
Var discount_msg ="
Your Discount is "+ discount +" %
";
Alert (discount); // pop-up information
$ ("P"). append ("123");
If
Qwert
After running
Qwert123
Jquery variable name requirements
It cannot start with a number, be case sensitive, have no mathematical operators, and cannot contain spaces or punctuation marks. It can be underlined,
$ (*) Select each element on the page
$ (". Guess_box"). click (function (){
$ (This). append ("hahaha ");
})
// When multiple elements hold the same class, you can use $ (this) to call the object of the current execution method when I only want to process the elements of my current operation.
The Code is as follows:
- 1
- 2
$ ("# BtnRemove"). click (function (){
$ ("Li"). remove ();
});
$ ("Li"). remove ();
Jquery descendant Selector
The Code is as follows:
$ ("P") Select All section elements under p
$ ("P") select all p elements under p
$ ("P img") Select All img elements under p
Bind events in two ways
The Code is as follows:
$ ("# MyElement"). click (function (){
Alert ("click ");
});
$ ("# MyElement"). bind ('click', function (){
Alert ("click ");
});
Onblur (); lost focus
Onchange ()
// Trigger a method if the Element Content Changes
The Code is as follows: