冒號 可以理解為 “匹配” 或 “選取”的意思。
$(":button") 表示匹配所有的按鈕。
$("input:checked")表示匹配所有選中的被選中元素(復選框、單選框等,不包括select中的option)。
$("div.container")中的'.'號表示class, $("div #msg")中的'#'表示id。那么$(":button") 中的':'表示類型(type),如$(":button") 表示類型為button的控件,$("input:checked")表示所有類型為選中的復選框元素。
$("input:checked")表示匹配所有選中的被選中元素(復選框、單選框等,不包括select中的option)。
$("div.container")中的'.'號表示class, $("div #msg")中的'#'表示id。那么$(":button") 中的':'表示類型(type),如$(":button") 表示類型為button的控件,$("input:checked")表示所有類型為選中的復選框元素。
:在css中代表偽選擇符,但是在jQuery里(因為jQuery里的選擇器很多地方都使用css中的表示方法),這里就是固定用法,還有如下表單控件:具體的你搜一下就有很多說明。
:input
:text
:password
:radio
:checkbox -->選取所有帶有 type="checkbox" 的 <input> 元素。
:input
:text
:password
:radio
:checkbox -->選取所有帶有 type="checkbox" 的 <input> 元素。
:checked -->選取所有被選中的checkbox 的值。
:submit
:image
:reset
:button
:file
:hidden
基本
:first
:last
:not
:even
:odd
:eq
:gt
:lt
:header
:animated
內容
:contains
:empty
:has
:parent
可見性
:hidden
:visible
:submit
:image
:reset
:button
:file
:hidden
基本
:first
:last
:not
:even
:odd
:eq
:gt
:lt
:header
:animated
內容
:contains
:empty
:has
:parent
可見性
:hidden
:visible