I had able to select multiple image file and preview in a div. There are a button on below of each of the image.
Input File HTML
<input type="file" class="span3" id="file[]" name="file[]" multiple />
When I selected TWO image, the number of file will become TWO. But when I using jquery to remove the image div, the number of file is still remain TWO. It show that jquery just remove the div but now remove the number of file.
This is my HTML
IMAGE 1
<div id="image_div0" class="image_div">
<div style="height: 190px;">
<img class="thumb" src="blob:http%3A//localhost%3A8888/902e3e76-d381-4b0a-9c45-f7be3b2eb7c9"/>
</div>
<div>
<button id="btnRemove_0" class="btn btn-primary" type="button">Remove</button>
</div>
</div>
IMAGE 2
<div id="image_div1" class="image_div">
<div style="height: 190px;">
<img class="thumb" src="blob:http%3A//localhost%3A8888/ce22463e-156e-4444-b193-7c1505ee1d6f"/>
</div>
<div>
<button id="btnRemove_1" class="btn btn-primary" type="button">Remove</button>
</div>
</div>
How to dynamically remove clicked image from image file..?
Example I selected three image and preview it. When I click on REMOVE button at first image, it only remove the first image and the number of "3" show in input file will change to "2".
Current I apply opacity for the image when REMOVE button is click.
$('.image_div').find('button').live('click', function(){
var selected_image_id = $(this).parents().parents().html();
$(this).parent('div').parent('div').find('div').css({
'opacity' : 0.3,
});
$(this).css('cursor','default')
});