Skip to content

Instantly share code, notes, and snippets.

@rezen
Created February 28, 2012 17:54
Show Gist options
  • Save rezen/1933981 to your computer and use it in GitHub Desktop.
Save rezen/1933981 to your computer and use it in GitHub Desktop.
JS: input[type=File upload mask input[type="file"]!
// File upload mask
$('.upload-masked').each(function(){
var $this = $(this)
, $mask = $('<input type="text" class="upload-mask" value="" />');
$this.wrap('<div class="input-wrap" style="position:relative;"></div>');
$this.css({opacity:0,position:'absolute'});
$this.after('<span class="upload-mask-button">BROWSE</span>');
$this.after($mask);
$this.change(function(){
var val = this.value;
$mask.val(val);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment