Follow the code:
$(document).ready(function () {
$("#myform").validate({
ignore: ":hidden",
rules: {
images: { required: true, extension: "jpg"},
messages: {
images: Arquivo inválido}
},
submitHandler: function (form) {
ajax - post ....
}
}
}
Html:
<input type="file" id="image_preview" class="form-control" name="images" accept="image/*">
I use this bootstrap fileinput
After choosing an image, I get an error:
Uncaught TypeError: Can not read property 'call' of undefined. Exception occurred when checking element image_preview, check the 'extension' method.
If I leave only "{ required: true}"
it works as the required field. With the extension type it does not work.
Any solution?