jQuery – :file Selector

The jQuery file selector selects all elements of type file. :file is equivalent to [type=”file”]

Source Code

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

File : <input type="file" /><br>
Text : <input type="text" />
<br/>
<button>Click Here</button>

  
<script>
jQuery("button").click(function () {
	jQuery("input:file").css({border:"3px #1E8CBE solid"});
});
</script>
</body>
</html>

Demo

Following example finds all file inputs and create a border around them.

File :
Text :

,

No comments yet.

Leave a Reply