JavaScript > HTML DOM

DOM Methods in JavaScript

What is the use of DOM Methods in javascript


DOM Methods

DOM Methods are defined as actions when we perform on html elements, DOM properties are values of html element that we can change or set the values.

All HTML elements as defined as objects, programming interface is an property and method of an object.

Property

Property is a value that we can set or get, for example changing content of HTML element

Method 

Method is an action performed while adding or deleting an element.

<body>
    <h1>Welcome</h1>
    <p id="demo"></p>
    <script>
        document.getElementById("demo").innerHTML = "TechFunda!";
    </script>
</body>

In the above code getElementById is a method and innerHTML is a property, GetElementById uses id to find element and innerHTML is used to change the value of element.

 Views: 4124 | Post Order: 204



Write for us






Hosting Recommendations