mercredi 18 mars 2015

Or operator not working inside jQuery

I have file input. For demo, when anything else except .png or .jpg uploads, an alert message will come that says, "this file is not supported". So, I have written jQuery like this:



if (extension != 'png' || extension != 'jpg') {
alert('This file is not supported');
}


But, it seem that it's not working. If I cut from this portion, || extension != 'jpg', function will work perfectly. What's the problem with that line?


Fiddle Work


Aucun commentaire:

Enregistrer un commentaire