Click here to Skip to main content
14,423,055 members

JavaScript

 
QuestionRelation between null and zero. Pin
GKP199222-Sep-18 22:21
professionalGKP199222-Sep-18 22:21 
AnswerRe: Relation between null and zero. Pin
Richard Deeming24-Sep-18 9:03
communityengineerRichard Deeming24-Sep-18 9:03 
GeneralRe: Relation between null and zero. Pin
GKP199224-Sep-18 18:37
professionalGKP199224-Sep-18 18:37 
QuestionTypeScript, Dropping Image and loading preview without posting, a working sample, FileReader, readAsDataUrl, reader.result Pin
jkirkerx19-Sep-18 8:55
professionaljkirkerx19-Sep-18 8:55 
QuestionCan't match this string in typescript using if and else if Pin
jkirkerx18-Sep-18 14:04
professionaljkirkerx18-Sep-18 14:04 
AnswerRe: Can't match this string in typescript using if and else if Pin
Graham Breach18-Sep-18 22:21
MemberGraham Breach18-Sep-18 22:21 
GeneralRe: Can't match this string in typescript using if and else if Pin
jkirkerx19-Sep-18 8:27
professionaljkirkerx19-Sep-18 8:27 
QuestionCan't match this string in typescript using if and else if Pin
jkirkerx18-Sep-18 14:04
professionaljkirkerx18-Sep-18 14:04 
I'm missing something here on matching the file type to the string.
I tried !== and !=
It must be related to the order of if and else if in which I'm not understanding the rule.
I've checked the heck out of the strings to make sure it can actually match.
Scratching my head on this one. Don't forget this is TypeScript and not JavaScript.

This doesn't work
if (files.length > 1) {
    event.dataTransfer.effectAllowed = 'none';
    this.containerAlert(1);            
    console.log('drag canceled for too many files');
    return false;
}
else if (fileType.split('/')[1] != 'jpeg' || fileType.split('/')[1] != 'png') {
    event.dataTransfer.effectAllowed = 'none';
    this.containerAlert(2);
    console.log('drag canceled for not being an image file = ' + fileType.split('/')[1]);
    return false;
}
else {
    this.containerReset();
    event.target.style.opacity = '0.4';  
}

This works
if (files.length > 1) {
    event.dataTransfer.effectAllowed = 'none';
    this.containerAlert(1);<br />
    console.log('drag canceled for too many files');
    return false;
}
else if (fileType.split('/')[1] == 'jpeg' || fileType.split('/')[1] == 'png') {
    this.containerReset();
    event.target.style.opacity = '0.4';  

}
else {
    event.dataTransfer.effectAllowed = 'none';
    this.containerAlert(2);
    console.log('drag canceled for not being an image file = ' + fileType.split('/')[1]);
    return false;
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com

QuestionHow to cancel a drag event Pin
jkirkerx18-Sep-18 10:25
professionaljkirkerx18-Sep-18 10:25 
AnswerRe: How to cancel a drag event Pin
Richard Deeming18-Sep-18 11:53
communityengineerRichard Deeming18-Sep-18 11:53 
GeneralRe: How to cancel a drag event Pin
jkirkerx18-Sep-18 12:54
professionaljkirkerx18-Sep-18 12:54 
Questioncouldn't read from datalist Pin
thepast16-Sep-18 22:01
Memberthepast16-Sep-18 22:01 
QuestionHow to pass JavaScript output to an HTML String Variable outside the <script>? Pin
Member 1348136115-Sep-18 16:45
MemberMember 1348136115-Sep-18 16:45 
AnswerRe: How to pass JavaScript output to an HTML String Variable outside the <script>? Pin
Richard Deeming18-Sep-18 4:45
communityengineerRichard Deeming18-Sep-18 4:45 
QuestionTrouble uploading files with aws s3 Pin
Member 1398382813-Sep-18 14:15
MemberMember 1398382813-Sep-18 14:15 
AnswerRe: Trouble uploading files with aws s3 Pin
jkirkerx1-Oct-18 9:04
professionaljkirkerx1-Oct-18 9:04 
Questiongetting error period.draggable is not a function Pin
Gopal Kan12-Sep-18 20:49
MemberGopal Kan12-Sep-18 20:49 
AnswerRe: getting error period.draggable is not a function Pin
Graham Breach12-Sep-18 22:08
MemberGraham Breach12-Sep-18 22:08 
QuestionModal popup with datalist Pin
thepast12-Sep-18 9:18
Memberthepast12-Sep-18 9:18 
QuestionJavascript and extensions Pin
Member 1398114211-Sep-18 16:10
MemberMember 1398114211-Sep-18 16:10 
QuestionWhen pressing right and left keys object not moving in javascript game. Pin
Member 1396097131-Aug-18 12:10
MemberMember 1396097131-Aug-18 12:10 
QuestionAngular 6, lazy loading, with routerLink="/reviews" it works, type the Url localhost:5000/reviews and page not found Pin
jkirkerx17-Aug-18 14:06
professionaljkirkerx17-Aug-18 14:06 
AnswerRe: Angular 6, lazy loading, with routerLink="/reviews" it works, type the Url localhost:5000/reviews and page not found Pin
jkirkerx18-Aug-18 14:31
professionaljkirkerx18-Aug-18 14:31 
General[Solved] Pin
jkirkerx20-Aug-18 10:25
professionaljkirkerx20-Aug-18 10:25 
QuestionCoding Newbie Pin
Rokas Steiblys17-Aug-18 11:21
MemberRokas Steiblys17-Aug-18 11:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.