Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Semantic UI File Upload Button
.field
.ui.button.fake-file-field
%i.upload.icon
%span.button-text Choose file
.hidden-file-field
= f.file_field :file
// Turn file input into a button
$('.hidden-file-field').hide();
$('.fake-file-field').click(function(e) {
$("input[type='file']").click();
});
$('.hidden-file-field').change(function() {
$('.button-text').text(
$('input[type=file]').val().split('\\').pop()
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.