:checkbox Seçicisi

checkbox Seçicisi
Açıklama : Tüm type="checkbox" olan elemanları seçer.

jQuery( ":checkbox" ) Eklendiği Versiyon 1.0

Bu $( ":checkbox" ) seçicisi geçerli standart CSS seçicisi $( "[type='checkbox']" ) ile eşdeğerdir. Tüm diğer sahte sınıf seçiciler (":" ile başlayanlar) gibi öncesinde bir eleman seçimi yapmanız iyi olacaktır, yoksa $( "*:checkbox" ) olarak değerlendirilir ve tüm elemanlara sorgulama yapar. Bunu yerine $("input:checkbox") şeklinde kullanımdaha performanslı olacaktır.


İlave Notlar :

  • Bu :checkbox seçicisi bir jQuery eklentisi olduğu için DOM querySelectorAll() metodu kadar performanslı değildir. Yüksek performans gereken durumlarda modern tarayıcılarda [type="checkbox"] kodunu kullanınız.

Örnekler:

Tüm checkbox input elemanları bulur.

<style> textarea { height: 25px; } </style>
<form>
   <input type="button" value="Input Button"><input type="checkbox">
   
   <input type="checkbox"><input type="file"><input type="hidden">
   
   <input type="image"><input type="password"><input type="radio">
   
   <input type="reset"><input type="submit"><input type="text">
   
   <select><option>Option</option></select>
   
   <textarea></textarea><button>Button</button>
</form>
 
<div></div>
<script>
   var input = $( "form input:checkbox" )
      .wrap( "<span></span>" )
      .parent()
      .css({ background: "yellow",
         border: "3px red solid" });
   
   $( "div" )
      .text( "For this type jQuery found " + input.length + "." )
      .css( "color", "red" );
</script>

.

.