:file Seçicisi

file selector
Açıklama : file tipi tüm elemanları bulur.

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

Bu :file seçicisi [type="file"] ile aynı işi yapar. Diğer sahte seçiciler gibi önünde başka bir seçici kullanılmalıdır. Aksi halde "*:file" olarak kabul edilir ve tüm elemanlarda arama yapar. Yani ":file" yerine "input:file" şeklinde kullanmak daha performanslıdır.



İlave Notlar :

  • :file bir jQuery eklentisi olduğu ve CSS standardı olmadığı için JavaScript querySelectorAll() metodu performansından yararlanamaz. Modern tarayıcılarda daha iyi bir performans için saf CSS seçici [type="file"] kullanınız.


Örnekler:

Tüm file input elemanları bul.

<style>
   textarea { height: 45px; }
</style>
<form>
   <input type="button" value="Input Button">
   <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 = $("input:file").css({
      background: "yellow",
      border: "3px red solid"
   });
   $("div")
      .text("For this type jQuery found " + input.length + ".")
      .css("color", "red");
   $("form").on("submit", function(event){
      event.preventDefault();
   });
</script>

.

.