+ 10
Expanding on the other very good answers posted by the other very talented people here, 😉... This question is a bit ambiguous in the specific references made to "Parent" and "Append". In jQuery, these are both methods: element.parent() element.append(childElement) In plain Javascript, there are some variations... Regarding Parent: 1. window.parent 2. node.parentNode 3. element.parentElement #1 refers to the parent window of the current window which will exist if opened from another window. #2 refers to any DOMNode including elements, attributes, etc. #3 refers specifically to Elements. All three are properties in plain JS, as opposed to the method used in jQuery. Regarding Append: 1. child = element.appendChild(child) 2. element.append(child) 3. element.append("some text") 4. element.append("some text", child) #1 will only append child elements and also returns the appended child. #2, 3, and 4 can append child nodes and/or text.
2nd Oct 2019, 6:57 PM
David Carroll
David Carroll - avatar
+ 8
Peter David Carter Totally agreed, thinking on the same question. Java/C# syntax is perfect in my humble opinion. I know there is a lot can be improved. But, in general, it's quite ok. I think JS will adopt more and more from Java/C# in future.
4th Oct 2019, 11:20 AM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar
+ 6
Aleksandar Nedeljkovic Yes, I work with Pascal, to be certain with Delphi) JS syntax in recent versions looks more and more alike Java.
2nd Oct 2019, 9:22 PM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar
+ 5
🇲 🇮 🇷 🇮 🇪🇱🇱🇪 explained it quite well Not much to add 😅 Element.append actively adds a new element as the child of Element Element.parent gives access to the parent node of the Element
2nd Oct 2019, 4:09 PM
Burey
Burey - avatar
+ 5
You give me too much credit Coder There are many talented individuals here in SL You can learn from anyone ;)
2nd Oct 2019, 4:12 PM
Burey
Burey - avatar
+ 4
This is one of the main reason for multiplatform distributions of Java David Carroll. Congratulations! 😁 😎 By the way, doesen't matter if we write code for WIN, Linux distributions, even MacOS... Code worked almost everywhere 😁 In particular, all excepts of the compiler and linker. And, yes, Java are Virtual Machine...😌
2nd Oct 2019, 7:18 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 4
JS are mix of Java, Pascal (have any work with Pascal?) and C++.
2nd Oct 2019, 7:22 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 4
Lev Tolstoy SPB Particularly similar once you have the Microsoft layer TypeScript over the top... With C# already pretty similar to Java I wonder how long before all three merge into one giant super language 😱🤣
4th Oct 2019, 8:15 AM
Peter David Carter
Peter David Carter - avatar
+ 3
Yes Lev Tolstoy SPB ! Borland Delphi are successor of Pascal with IDE 😎 I remember early Delphi 1 and Delphi 2 😀 But before Delphi, it was Borland Turbo Vision 2.0 with Turbo Objects 😎 Even more, I remember QBASIC (shorten version of QuickBASIC) and he came with MS DOS 5.0 I think. Before that, Microsoft distributed GW BASIC 3.0, 3.2, 3.21 and 3.22 with line numbers. You know: 10 FOR I = 1 TO 10 20 PRINT I 30 NEXT I 😎
2nd Oct 2019, 10:59 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 2
The append() method inserts specified content at the end of the selected elements.Parent() method only traverse a single level up the DOM tree. To traverse all the way up to the document's root element.
3rd Oct 2019, 4:31 AM
Shaili Shah
Shaili Shah - avatar