Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML DOM small object
The HTML DOM small object is associated with HTML <small> element. We can create and access small element using the createElement() and getElementById() method respectively.
Syntax
Following is the syntax for −
Creating a small object −
var s= document.createElement("SMALL");
Example
Let us look at an example for the small object −
<!DOCTYPE html>
<html>
<body>
<h1>Small object example</h1>
<p>Create a small element containing some text by clicking the below button</p>
<button onclick="CreateSmall()">CREATE</button>
<p>This is normal text</p>
<script>
function CreateSmall() {
var s = document.createElement("SMALL");
var txt = document.createTextNode("This is small text");
s.appendChild(txt);
document.body.appendChild(s);
}
</script>
</body>
</html>
Output
This will produce the following output −

On clicking the CREATE button −

Advertisements
