I want to check its valid image or not. My code valid image is as follow and its work perfects but, when its image array then it doesn't work?
$("#file").change(function() {
var val = $(this).val();
switch(val.substring(val.lastIndexOf('.') + 1).toLowerCase()){
case 'gif': case 'jpg': case 'png':
//alert("an image");
break;
default:
$(this).val('');
// error message here
alert("Please Select Valid Image");
break;
}
});
its work perfect for one image means its work on id but now I want to work with image array then what I do ? its possible or not?
<input id="file" type="file" name="images[]">Enter 8 Images For Batter Product View
<input type="button" id="addmore" value="Add More Image">
in add more image its give me the new image so I take an array so I want to check in the array this change function its valid image or not? is it possible?
thanks