Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohammadYousefiDev/2cb56b5e7b0c453ac26eae849cfcfa02 to your computer and use it in GitHub Desktop.
Save mohammadYousefiDev/2cb56b5e7b0c453ac26eae849cfcfa02 to your computer and use it in GitHub Desktop.
show file name when file input changed in mdb
<div class="form-file">
<input type="file" class="form-file-input" onchange="changeFile(this.files[0].name, 'form-file-personal-text')" id="customFile" name="personal" required/>
<label class="form-file-label" for="customFile">
<span class="form-file-text" id="form-file-personal-text">Personal Image ...</span>
<span class="form-file-button">Select</span>
</label>
</div>
<script>
function changeFile(filename, id)
{
document.getElementById(id).innerHTML = filename;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment