JQuery knowledge point sorting _ jquery

Source: Internet
Author: User
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. 1

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




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.