How to Use the Attribute Object’s Properties to Code with JavaScript

In JavaScript, the Attribute object provides properties for working with attributes within the HTML elements. Here is a list of all the Attribute object’s properties.
Property                               Use
isId                                      Yields true if the attribute is an Id; otherwise, yields false
name                                   Gets the name of the attribute
value                                    Gets or sets the value of the attribute
specified                             Yields true if the attribute has been specified; otherwise, yields false

Create and append items
To create a new element in an HTML document, use document.create
element() method. When you use createElement(), a new start and end tag of the type you specify will be created.
Remove items
For all the cool things it lets you do with HTML documents, the HTML DOM is not much appreciated by professional JavaScript programmers. It has a number of oddities and tends to make some things more difficult than they should be.
One of the biggest drawbacks of the DOM is that it does not provide any way to directly remove an element from the document. Instead, you have to tell the DOM to find the parent element of the element you want to remove and then tell the parent to remove its child element. It looks a bit confusing

When this code is run in the browser and the button is pressed, the onclick event calls the removeFirstParagraph() function.
The first thing removeFirstParagraph() does is select the element you actually want to remove, the element that has id=”first paragraph”. Next, the script selects the original node of the first paragraph. Then it uses the removeChild() method to remove the first paragraph.