How to change no file chosen to a filename in Bootstrap using jQuery.?

219 views Asked by At

I am trying to set no file chosen in upload file to a filename . How to set no file chosen to a file name. What I have tried is:

<input class="form-control" id="imgInp" type="file" accept=".png,.jpg,.jpeg" name="img" required> 

On load of a form , I am trying to set value of no file chosen to a filename

$('#imgInp').val('abcd.jpg');

Output

How to change no file chosen in file input?

1

There are 1 answers

0
Wayne On

Easy Solution:

Add placeholder

<input class="form-control" id="imgInp" placeholder="no file chosen" type="file" accept=".png,.jpg,.jpeg" name="img" required>