Home  >  Article  >  Web Front-end  >  What does colon mean in jquery syntax?

What does colon mean in jquery syntax?

WBOY
WBOYOriginal
2022-06-09 16:25:051842browse

The colon in jquery syntax means "match" or "select". The content after the colon indicates the element that needs to be selected; for example, "$(":element")" indicates that the specified element is to be matched. "$("input:checked")" means matching all selected elements.

What does colon mean in jquery syntax?

The operating environment of this tutorial: windows10 system, jquery3.4.1 version, Dell G3 computer.

What does the colon mean in jquery syntax

The colon can be understood as "matching" or "selecting".

$(":button") means matching all buttons.

$("input:checked") means matching all selected selected elements (check boxes, radio buttons, etc., excluding options in select). The '.' in

$("div.container") represents class, and the '#' in $("div #msg") represents id. Then the ':' in $(":button") represents the type (type), such as $(":button") represents a control of type button, $("input:checked") represents all types of checked checks box element.

: represents pseudo-selector in css, but in jQuery (because the selector in jQuery uses the representation method in css in many places), here is the fixed usage, and there are also the following form controls: Specific There are many explanations if you search.

For example:

  • :input

  • :text

  • : password

  • :radio

  • :checkbox -->Select all elements with type="checkbox".

  • :checked -->Select the values ​​of all selected checkboxes.

  • :submit

  • :image

  • :reset

  • :button

  • :file

  • :hidden

Video tutorial recommendation: jQuery video tutorial

The above is the detailed content of What does colon mean in jquery syntax?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn