Skip to content

Instantly share code, notes, and snippets.

@lcdsantos
Created December 5, 2016 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcdsantos/d09e172f81fab313761d4282ad0786c9 to your computer and use it in GitHub Desktop.
Save lcdsantos/d09e172f81fab313761d4282ad0786c9 to your computer and use it in GitHub Desktop.
/*! Custom Input File v1.0 - Copyright (c) 2016 Leonardo Santos */
(function($) {
$.fn.inputFile = function() {
return this.each(function() {
var $this = $(this);
$this
.on('change', function() {
var value = /[^(\\|\/)]*$/.exec($this.val());
$this.siblings('span').text(value[0]);
})
.on('mouseenter mouseleave', function() {
$this.parent().toggleClass('hover');
});
})
}
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment