Last Updated: September 09, 2019
·
3.177K
· adelonzeta

Customizing input file in html forms

Preview:
Picture

The Markup:

<span class="customInputFile">
    <a href="javascript:void(0)">Choose an image in your computer.</a>
    <input type="file" />
</span>

The CSS:

.customInputFile input[type="file"] {
    display: none;
}
.customInputFile a {
    background: #fff;
    border: 1px dashed rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    display: block;
    padding: 8px 0;
    text-align: center;
}

The JQuery:

$('.customInputFile a').on("click", function() {
    $(this).next('input[type="file"]').click();
});

2 Responses
Add your response

Do you have a link to see this in action?

over 1 year ago ·

@cseckler , yeah it's on fundmytravel.com. You need first to create a campaign before you can view this on the user-admin though. :D

over 1 year ago ·