Click here to Skip to main content
15,889,595 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Incrementing/Decrementing not by 1 Pin
Peter_in_278029-Jul-15 20:27
professionalPeter_in_278029-Jul-15 20:27 
QuestionOK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton28-Jul-15 15:19
mvaMarc Clifton28-Jul-15 15:19 
QuestionRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming29-Jul-15 1:50
mveRichard Deeming29-Jul-15 1:50 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton29-Jul-15 4:39
mvaMarc Clifton29-Jul-15 4:39 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming29-Jul-15 4:47
mveRichard Deeming29-Jul-15 4:47 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton29-Jul-15 5:09
mvaMarc Clifton29-Jul-15 5:09 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Afzaal Ahmad Zeeshan29-Jul-15 5:20
professionalAfzaal Ahmad Zeeshan29-Jul-15 5:20 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore30-Jul-15 22:22
professionalF-ES Sitecore30-Jul-15 22:22 
To take a stab at the original question, jquery functions always return collections which is why a) can chain things b) never have to check for nulls. If $(e.target) returned a single thing and parents('.jqx-tree') returned a single thing then your code would make sense and work. But you actually have a foreach loop acting on a foreach loop...the first $() returns a collection (even if that collection only has one item) and the .parents works on each item in that collection and returns its own collection which your .length acts on. Now imaging $(..) returns 3 items (a, b and c) and the .parents of each of those items returns 1,0 and 5 items.

a.parents.length = 1
b.parents.length = 0
c.parents.length = 5

now your code

JavaScript
if ($(e.target).parents('.jqx-tree').length > 0)


makes less sense, which "length" are you evaluating? This idea about returning collections is probably what is stopping your code from working how you would expect. Maybe Smile | :) someone might know better.
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming31-Jul-15 0:40
mveRichard Deeming31-Jul-15 0:40 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore31-Jul-15 1:03
professionalF-ES Sitecore31-Jul-15 1:03 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming31-Jul-15 1:04
mveRichard Deeming31-Jul-15 1:04 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore31-Jul-15 1:11
professionalF-ES Sitecore31-Jul-15 1:11 
QuestionNeed to get client system date and time format Pin
pk.pradeep28-Jul-15 4:07
pk.pradeep28-Jul-15 4:07 
QuestionDisplay data from SQL database to HTML page in table format using Angular JS Pin
iamcpmember27-Jul-15 0:38
professionaliamcpmember27-Jul-15 0:38 
AnswerRe: Display data from SQL database to HTML page in table format using Angular JS Pin
mohammad hasnain raza28-Jul-15 1:21
professionalmohammad hasnain raza28-Jul-15 1:21 
RantSometimes I make something simple into something difficult Pin
Member 1183686426-Jul-15 7:38
Member 1183686426-Jul-15 7:38 
GeneralRe: Sometimes I make something simple into something difficult Pin
mohammad hasnain raza28-Jul-15 1:26
professionalmohammad hasnain raza28-Jul-15 1:26 
QuestionCreating an array of graphic files... Pin
Rayj201025-Jul-15 7:31
Rayj201025-Jul-15 7:31 
QuestionChanging the last text of a loop Pin
Member 1184968824-Jul-15 4:53
Member 1184968824-Jul-15 4:53 
AnswerRe: Changing the last text of a loop Pin
Richard MacCutchan24-Jul-15 5:40
mveRichard MacCutchan24-Jul-15 5:40 
AnswerRe: Changing the last text of a loop Pin
ZurdoDev24-Jul-15 5:58
professionalZurdoDev24-Jul-15 5:58 
AnswerRe: Changing the last text of a loop Pin
Anil Vaghasiya24-Jul-15 19:52
professionalAnil Vaghasiya24-Jul-15 19:52 
QuestionHow do I make the Comment box conditional mandatory box? (SOLVED) Pin
samflex23-Jul-15 8:20
samflex23-Jul-15 8:20 
AnswerRe: How do I make the Comment box conditional mandatory box? Pin
Richard Deeming23-Jul-15 9:04
mveRichard Deeming23-Jul-15 9:04 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
samflex23-Jul-15 9:14
samflex23-Jul-15 9:14 

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.