I have a Javascript code where it appends a blank file input into a table row and a clear button.
$('.imageFile').each( function() {
var $this = $(this);
var $imagefile = $("<input type='file' class='imageFileRow'>").attr('name',$this.attr('name')+"[]")
.attr('value',$this.val());
$image.append($imagefile);
var $imageclear = $('<input />')
.attr({
type: 'button',
name: 'imageClear',
class: 'imageClear',
value: 'Clear File'
});
$image.append($imageclear);
});
But what I want to know if it is possible is that if the user selects a file using the textbox above, it obviously stores the file link in that file input textbox, but I want it to store the file link in a hidden input I have in the form code below. Also if the user clicks on the 'Clear file' button, it clears the file not only in the file input textbox above but also in the hidden input as well.
Below is form code which contains the hidden input:
<form id="QandA" action="insertQuestion.php" method="post" >
<input type="hidden" class="imageFile" name="fileImage">
</form>