Селектор :radio


Содержание:

radio selector

Описание: Selects all elements of type radio.

  • Добавлен в версии: 1.0jQuery( ":radio" )

$( ":radio" ) is equivalent to $( "[type=radio]" ). As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare $( ":radio" ) is equivalent to $( "*:radio" ), so $( "input:radio" ) should be used instead.

To select a set of associated radio buttons, you might use: $( "input[name=gender]:radio" )

Дополнительные замечания:

  • Because :radio is a jQuery extension and not part of the CSS specification, queries using :radio cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use [type="radio"] instead.