Reputation: 347
Select just by type, every element, <input type="file" name="userfile" >
<input type="file" name="userfile" >
Upvotes: 7
Views: 28229
Reputation: 17944
You may use the :file
pseudo-class selector:
as a stand-alone :file
$(":file")
or
on an input
type: input:file
$("input:file")
Example:
$("input:file").css('background', 'lightgreen');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<input type="file">
Upvotes: 5
Reputation: 2995
Select all elements by type 'file' like so:
$('[type="file"]')
Ref.: Attribute Equals Selector [name=”value”]
Upvotes: 1
Reputation: 498
With this code you can select an input with type "file":
$('input[type="file"]')
Upvotes: 30