Javascript examples for jQuery Selector:file
The :file selector selects input elements with type=file.
The following code shows how to select <input> elements with type="file":
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(":file").css("background-color", "blue"); });//w ww .j ava2s .c om </script> </head> <body> <form action=""> Name: <input type="text" name="user"><br> File: <input type="file" name="myfile"> </form> <form action=""> Name: <input type="text" name="user"><br> File: <input type="file" name="myfile"> </form> </body> </html>