jquery Basic Operations

Source: Internet
Author: User

1.CSS style operation

1) Get Style $ (' div '). css (' width '));

2) Get more than one style of an element $ (' div '). css ([' width ', ' height '])

3) Modify Style $ (' div '). css (' width ', ' 200px ');

      $ (' div '). css (' Color ', function (index,value) {

Console.log (index,value); return ' Pink ';
});

4) bulk Modify Style $ (' div '). css ({' Color ': ' Pink ', ' width ': ' 200px '});

2.value operation

1) Get the text box contents $ (' input '). Val ();

2). Gets the check box for the selected content:console.log ($ ('. box:checked '));

3 sets the value of the text box to $ ('. Text '). Val ("Country");

4) Set check box to select $ ('. Box '). val ([1,3]);

5) Gets the value of the radio box of $ ('. s:checked '). Val ();

6) Set the value of the radio box to $ ('. S '). Val ([' C ']);

7) Gets the value of the drop-down list by selecting $ (' option:selected '). Val ();

Multi-Select $ (' select '). Val ()

8) Set the value of the drop-down list to $ (' select '). val ([' E ', ' A ']);

3. Simple event operation

1) mouseover

2) mouseout

3) MouseEnter () and MouseLeave () do not trigger when passing through a child element

The MouseOver event is triggered regardless of whether the mouse pointer passes through the selected element or its child elements.
The MouseEnter event is triggered only when the mouse pointer passes through the selected element.

  

jquery Basic Operations

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.