So I have an input type file and textarea. I want to show the file name in textarea on input type file change. Here I have reached something, but this works only for the first time and when I write some text and want to select another file I don't get that file name in textarea.
<!DOCTYPE html><html><head><title>victory please</title><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script><style>
#list {
width: 500px;
height: 650px;
}</style></head><body><input type="file" name="img[]" id="file"><input type="submit" name="submit" id="submit"><br><br><textarea id="list" name="list"></textarea><div id="demo"></div><script>
$('#file').change(function () {
var value = $('#file').val();
$('#list').append(value);
});
$('#submit').click(function() {
var a = getElementById('list').value;
getElementById('demo') = a;
});</script></body></html>