144
rated 0 times
[
151]
[
7]
/ answers: 1 / hits: 163122
/ 11 Years ago, thu, august 1, 2013, 12:00:00
I am triggering a file upload on href click.
I am trying to block all extension except doc, docx and pdf.
I am not getting the correct alert value.
<div class=cv> Would you like to attach you CV? <a href= id=resume_link>Click here</a></div>
<input type=file id=resume style=visibility: hidden>
Javascript:
var myfile=;
$('#resume_link').click(function() {
$('#resume').trigger('click');
myfile=$('#resume').val();
var ext = myfile.split('.').pop();
//var extension = myfile.substr( (myfile.lastIndexOf('.') +1) );
if(ext==pdf || ext==docx || ext==doc){
alert(ext);
}
else{
alert(ext);
}
})
MyFiddle..its showing error
More From » jquery