+ 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.
+ 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.
+ 6
Aleksandar Nedeljkovic Yes, I work with Pascal, to be certain with Delphi)
JS syntax in recent versions looks more and more alike Java.
+ 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
+ 5
You give me too much credit Coder
There are many talented individuals here in SL
You can learn from anyone ;)
+ 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...😌
+ 4
JS are mix of Java, Pascal (have any work with Pascal?) and C++.
+ 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 😱🤣
+ 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
😎
+ 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.