Check the valid email address in JavaScript

Check the valid email address in JavaScript

Check Valid Email::

function validateEmail(email) {

    var re = /^(([^<>()\[\]\\.,;:\[email protected]"]+(\.[^<>()\[\]\\.,;:\[email protected]"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

    return re.test(email);

}

Check the Uploaded File is valid format in Javascript

Check the Uploaded File is valid format in JavaScript or JQuery

 

$('.doc_file_upload').on( 'change', function() {

        myfile= $( this ).val();

        var ext = myfile.split('.').pop();

        if(ext=="pdf" || ext=="docx" || ext=="doc"){

        } else{

             $( this ).val('');

            alert("Invalid Format");

        }

});