Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Example(s) for comprehension of DOM Element(Nodes)

Featured Replies

I was reading on the W3 site about Nodes and came across this script

<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>


<script>
var para=document.createElement("p");
var node=document.createTextNode("This is new.");
para.appendChild(node);


var element=document.getElementById("div1");
element.appendChild(para);
</script>

The structure above is classic inheritance insertion. My problem is, what purpose does this structure have in the web industry? What kind of problem would this structure solve?

Edited by drt_t1gg3r

This kind of stuff is very rarely used now. Developers would tend to go with a templating system. An example of a templating system is Handlebars.js. Underscore,is also good for templating.

 

 

Quite a lot of the articles on W3 Schools are old and not updated with more modern methods. Check out https://developer.mozilla.org/en-US/ it's a far better resource than W3 Schools.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.