Skip to content

Instantly share code, notes, and snippets.

@patsuckow
Last active January 30, 2022 11:57
Show Gist options
  • Select an option

  • Save patsuckow/9844f8ce6bb0e32e71782bd5379a8384 to your computer and use it in GitHub Desktop.

Select an option

Save patsuckow/9844f8ce6bb0e32e71782bd5379a8384 to your computer and use it in GitHub Desktop.
Нормальная форма выбора файла для Bootstrap4.0
HTML:
======
<div class="custom-file">
<input type="file" id="myfile" class="custom-file-input" onchange="$(this).next().after().text($(this).val().split('\\').slice(-1)[0])">
<label class="custom-file-label" for="customFile">Выберите файл</label>
</div>
CSS:
======
.custom-file-label::after{
content: 'Обзор';
}
Обрезает весь путь и выводит только имя и расширение файла в строке выбора.
@metelica88
Copy link

@tach-tm
Copy link

tach-tm commented Dec 25, 2021

А можно поменять текст "Выбор файла" и "Не выбран ни один файл"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment