<input>
for select images:
<input type="file" class="form-control forminputs files photoimg" multiple name="photoimg[]" placeholder="Choose 3 image files" accept="image/png,image/jpeg" id="photoimg" />
I am trying to select at least 3 images. If it is exceeded 3, then it alerts "please select 3" and again automatically opens file browse window.
Up to alert
everything works fine but after that file browse window is not opening.
JS code:
$('#photoimg').change(function() {
var files = this.files.length;
if (files > 3)
{
alert("Please select 3 images only(png/jpg)");
document.getElementById("photoimg").click();
}
});
tried with this.click() and $('#photoimg').click();.
$('#photoimg').click(function() {
alert("clicked");
});
to test it click event was taken, click event was working but still file browse was not working. Why it is not working?