132
rated 0 times
[
135]
[
3]
/ answers: 1 / hits: 30234
/ 11 Years ago, mon, january 6, 2014, 12:00:00
I have a JQuery script that validates the upload of avatar images but I need it to prevent the upload of anything other than PNG, JPG & GIF images. Any way of implementing this into the code I have? Here is the code:
$('#addButton').click(function () {
var avatar = $(#avatarupload).val();
if(avatar.length < 1) {
avatarok = 0;
}
//ELSE IF FILE TYPE
else {
avatarok = 1;
}
if(avatarok == 1) {
$('.formValidation').addClass(sending);
$(#form).submit();
}
else {
$('.formValidation').addClass(validationError);
}
return false;
});
More From » jquery