Просмотр файла bootstrap/js/path.js

Размер файла: 955B
  1. (function ($){
  2. $(function (){
  3. $('.btn').each(function (){
  4. var self = this;
  5. $('input[type=file]', this).change(function (){
  6. // remove existing file info
  7. $(self).next().remove();
  8. // get value
  9. var value = $(this).val();
  10. // get file name
  11. var fileName = value.substring(value.lastIndexOf('/')+1);
  12. // get file extension
  13. var fileExt = fileName.split('.').pop().toLowerCase();
  14. // append file info
  15. $('<span><i class="icon-file icon-' + fileExt + '"></i> ' + fileName + '</span>').insertAfter(self);
  16. });
  17. });
  18. });
  19. })(jQuery);