Select just by type, every element, <input type="file" name="userfile" >
<input type="file" name="userfile" >
With this code you can select an input with type "file":
$('input[type="file"]')
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">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With