I am using krajee-file-input-plugin.I want to clear selected file based of file type.I have tried the following code but no result.
@Html.TextBoxFor(m => m.PhotoUrl,
class = "form-control imgUpload", @placeholder = "Please upload Photo",
@id = "txtPhoto", @type = "file" })
//fileUpload plugin
$(".imgUpload").fileinput({
showUpload: false
});
$(".imgUpload").change(function () {
var ext = $(this).val().split('.').pop().toLowerCase();
switch (ext) {
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
break;
default:
$(this).remove();
alert('This is not an allowed file type.');
}
});
Here $(this).remove()
function is not working properly